ILIAS  release_8 Revision v8.24
hasSymbolTrait.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
21
25use LogicException;
26
32{
33 protected ?Symbol $symbol = null;
34
38 public function withSymbol(Symbol $symbol): hasSymbol
39 {
40 // bugfix mantis 25526: make aria labels mandatory
41 if (($symbol instanceof Glyph && $symbol->getAriaLabel() === "") ||
42 ($symbol instanceof Icon && $symbol->getLabel() === "")) {
43 throw new LogicException("the symbol's aria label MUST be set to ensure accessibility");
44 }
45
46 $clone = clone $this;
47 $clone->symbol = $symbol;
48
49 return $clone;
50 }
51
55 public function getSymbol(): Symbol
56 {
57 return $this->symbol;
58 }
59
63 public function hasSymbol(): bool
64 {
65 return $this->symbol instanceof Symbol;
66 }
67}
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:33
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:31
This describes a symbol.
Definition: Symbol.php:30
getLabel()
Get the label of this icon.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait hasSymbolTrait
Trait hasSymbolTrait.
withSymbol(Symbol $symbol)
@inheritDoc