ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
Glyph.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\UI\Implementation\Component\ComponentHelper;
27
29{
30 use ComponentHelper;
32
33 private static array $types = [
34 self::SETTINGS,
35 self::COLLAPSE,
36 self::COLLAPSE_HORIZONTAL,
37 self::EXPAND,
38 self::ADD,
39 self::REMOVE,
40 self::UP,
41 self::DOWN,
42 self::BACK,
43 self::NEXT,
44 self::SORT_ASCENDING,
45 self::SORT_DESCENDING,
47 self::MAIL,
48 self::NOTIFICATION,
50 self::NOTE,
51 self::COMMENT,
52 self::BRIEFCASE,
53 self::LIKE,
54 self::LOVE,
55 self::DISLIKE,
56 self::LAUGH,
57 self::ASTOUNDED,
58 self::SAD,
59 self::ANGRY,
60 self::EYEOPEN,
61 self::EYECLOSED,
62 self::ATTACHMENT,
63 self::RESET,
64 self::APPLY,
65 self::SEARCH,
66 self::HELP,
67 self::CALENDAR,
68 self::TIME,
69 self::CLOSE,
70 self::MORE,
71 self::DISCLOSURE,
72 self::LANGUAGE,
73 self::LOGIN,
74 self::LOGOUT,
75 self::BULLETLIST,
76 self::NUMBEREDLIST,
77 self::LISTINDENT,
78 self::LISTOUTDENT,
79 self::FILTER,
80 self::HEADER,
81 self::ITALIC,
82 self::BOLD,
83 self::LINK,
84 self::LAUNCH,
85 self::ENLARGE,
86 self::LIST_VIEW,
87 self::PREVIEW,
88 self::SORT,
89 self::COLUMN_SELECTION,
90 self::TILE_VIEW,
91 self::DRAG_HANDLE,
92 self::CHECKED,
93 self::UNCHECKED,
94 ];
95
96 private string $type;
97 private string $label;
98 private array $counters;
99 private bool $highlighted;
100
101 public function __construct(string $type, string $label)
102 {
103 $this->checkArgIsElement("type", $type, self::$types, "glyph type");
104
105 $this->type = $type;
106 $this->label = $label;
107 $this->counters = array();
108 $this->highlighted = false;
109 }
110
111 public function getType(): string
112 {
113 return $this->type;
114 }
115
116 public function getLabel(): string
117 {
118 return $this->label;
119 }
120
121 public function withLabel(string $label): self
122 {
123 $clone = clone $this;
124 $clone->label = $label;
125 return $clone;
126 }
127
128 public function getCounters(): array
129 {
130 return array_values($this->counters);
131 }
132
134 {
135 $clone = clone $this;
136 $clone->counters[$counter->getType()] = $counter;
137 return $clone;
138 }
139
140 public function isHighlighted(): bool
141 {
142 return $this->highlighted;
143 }
144
145 public function withHighlight(): C\Symbol\Glyph\Glyph
146 {
147 $clone = clone $this;
148 $clone->highlighted = true;
149 return $clone;
150 }
151
152}
__construct(string $type, string $label)
Definition: Glyph.php:101
This tags a counter object.
Definition: Counter.php:29
This describes a symbol.
Definition: Symbol.php:30
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
$counter