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