ILIAS  release_8 Revision v8.24
TreeTool.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30use LogicException;
31
37{
39
40 protected ?Symbol $symbol = null;
41 protected Tree $tree;
42 protected string $title;
43
48 public function withTitle(string $title): hasTitle
49 {
50 $clone = clone($this);
51 $clone->title = $title;
52
53 return $clone;
54 }
55
59 public function getTitle(): string
60 {
61 return $this->title;
62 }
63
68 {
69 // bugfix mantis 25526: make aria labels mandatory
70 if (($symbol instanceof Glyph\Glyph && $symbol->getAriaLabel() === "") ||
71 ($symbol instanceof Icon\Icon && $symbol->getLabel() === "")) {
72 throw new LogicException("the symbol's aria label MUST be set to ensure accessibility");
73 }
74
75 $clone = clone($this);
76 $clone->symbol = $symbol;
77
78 return $clone;
79 }
80
84 public function withTree(Tree $tree): self
85 {
86 $clone = clone($this);
87 $clone->tree = $tree;
88
89 return $clone;
90 }
91
95 public function getTree(): Tree
96 {
97 return $this->tree;
98 }
99
103 public function getSymbol(): Symbol
104 {
105 return $this->symbol;
106 }
107
111 public function hasSymbol(): bool
112 {
113 return ($this->symbol instanceof Symbol);
114 }
115}
withSymbol(Symbol $symbol)
@inheritDoc
Definition: TreeTool.php: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 how an icon could be modified during construction of UI.
Definition: Icon.php:29
This describes a symbol.
Definition: Symbol.php:30
getLabel()
Get the label of this icon.
This describes a Tree Control.
Definition: Tree.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Custom.php:21