ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
TreeTool.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30use LogicException;
33
38{
40
41 protected ?Symbol $symbol = null;
42 protected Tree $tree;
43 protected string $title;
44
45 public function withTitle(string $title): hasTitle
46 {
47 $clone = clone($this);
48 $clone->title = $title;
49
50 return $clone;
51 }
52
53 public function getTitle(): string
54 {
55 return $this->title;
56 }
57
59 {
60 // bugfix mantis 25526: make aria labels mandatory
61 if (($symbol instanceof Glyph\Glyph && $symbol->getAriaLabel() === "") ||
62 ($symbol instanceof Icon\Icon && $symbol->getLabel() === "")) {
63 throw new LogicException("the symbol's aria label MUST be set to ensure accessibility");
64 }
65
66 $clone = clone($this);
67 $clone->symbol = $symbol;
68
69 return $clone;
70 }
71
72 public function withTree(Tree $tree): self
73 {
74 $clone = clone($this);
75 $clone->tree = $tree;
76
77 return $clone;
78 }
79
80 public function getTree(): Tree
81 {
82 return $this->tree;
83 }
84
85 public function getSymbol(): Symbol
86 {
87 return $this->symbol;
88 }
89
90 public function hasSymbol(): bool
91 {
92 return ($this->symbol instanceof Symbol);
93 }
94}
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