ILIAS
trunk Revision v11.0_alpha-3011-gc6b235a2e85
◀ ilDoc Overview
hasSymbolTrait.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\GlobalScreen\Scope\MainMenu\Factory
;
22
23
use
ILIAS\UI\Component\Symbol\Glyph\Glyph
;
24
use
ILIAS\UI\Component\Symbol\Symbol
;
25
use
ILIAS\UI\Implementation\Component\Symbol\Icon\Icon
;
26
use LogicException;
27
32
trait
hasSymbolTrait
33
{
34
protected
?
Symbol
$symbol =
null
;
35
39
public
function
withSymbol
(
Symbol
$symbol):
hasSymbol
40
{
41
// bugfix mantis 25526: make aria labels mandatory
42
if
(($symbol instanceof
Glyph
&& $symbol->getAriaLabel() ===
""
) ||
43
($symbol instanceof
Icon
&& $symbol->
getLabel
() ===
""
)) {
44
throw
new
LogicException(
"the symbol's aria label MUST be set to ensure accessibility"
);
45
}
46
47
$clone = clone $this;
48
$clone->symbol = $symbol;
49
50
return
$clone;
51
}
52
56
public
function
getSymbol
():
Symbol
57
{
58
return
$this->symbol;
59
}
60
64
public
function
hasSymbol
(): bool
65
{
66
return
$this->
symbol
instanceof
Symbol
;
67
}
68
}
ILIAS\UI\Implementation\Component\Symbol\Icon\Icon
Definition:
Icon.php:28
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol
Definition:
hasSymbol.php:31
ILIAS\UI\Component\Symbol\Glyph\Glyph
Definition:
Glyph.php:29
ILIAS\UI\Component\Symbol\Symbol
This describes a symbol.
Definition:
Symbol.php:30
ILIAS\UI\Component\Symbol\Symbol\getLabel
getLabel()
Get the label of this icon.
ILIAS\GlobalScreen\Scope\MainMenu\Factory
Definition:
AbstractBaseItem.php:21
ILIAS\GlobalScreen\Scope\MainMenu\Factory\getSymbol
getSymbol()
@inheritDoc
Definition:
hasSymbolTrait.php:56
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbolTrait
trait hasSymbolTrait
Trait hasSymbolTrait.
Definition:
hasSymbolTrait.php:33
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol
hasSymbol()
@inheritDoc
Definition:
hasSymbolTrait.php:64
ILIAS\GlobalScreen\Scope\MainMenu\Factory\withSymbol
withSymbol(Symbol $symbol)
@inheritDoc
Definition:
hasSymbolTrait.php:39
ILIAS\Repository\symbol
symbol()
Definition:
trait.GlobalDICGUIServices.php:216
components
ILIAS
GlobalScreen
src
Scope
MainMenu
Factory
hasSymbolTrait.php
Generated on Sat Oct 18 2025 23:03:07 for ILIAS by
1.9.4 (using
Doxyfile
)