ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Item.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4
6
9
13abstract class Item implements C\Item\Item
14{
16
20 protected $color = null;
21
25 protected $title;
26
30 protected $desc;
31
35 protected $props;
36
40 protected $actions;
41
45 protected $lead = null;
46
47 public function __construct($title)
48 {
49 if (!$title instanceof \ILIAS\UI\Component\Button\Shy) {
50 $this->checkStringArg("title", $title);
51 }
52 $this->title = $title;
53 $this->props = [];
54 }
55
59 public function getTitle()
60 {
61 return $this->title;
62 }
63
67 public function withDescription($desc)
68 {
69 $this->checkStringArg("description", $desc);
70 $clone = clone $this;
71 $clone->desc = $desc;
72 return $clone;
73 }
74
78 public function getDescription()
79 {
80 return $this->desc;
81 }
82
86 public function withProperties(array $props)
87 {
88 $clone = clone $this;
89 $clone->props = $props;
90 return $clone;
91 }
92
96 public function getProperties()
97 {
98 return $this->props;
99 }
100
104 public function withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
105 {
106 $clone = clone $this;
107 $clone->actions = $actions;
108 return $clone;
109 }
110
114 public function getActions()
115 {
116 return $this->actions;
117 }
118
122 public function withColor(\ILIAS\Data\Color $color)
123 {
124 $clone = clone $this;
125 $clone->color = $color;
126
127 return $clone;
128 }
129
133 public function getColor()
134 {
135 return $this->color;
136 }
137
141 public function withLeadImage(\ILIAS\UI\Component\Image\Image $image)
142 {
143 $clone = clone $this;
144 $clone->lead = $image;
145 return $clone;
146 }
147
151 public function withLeadIcon(\ILIAS\UI\Component\Icon\Icon $icon)
152 {
153 $clone = clone $this;
154 $clone->lead = $icon;
155 return $clone;
156 }
157
161 public function withLeadText($text)
162 {
163 $this->checkStringArg("lead_text", $text);
164 $clone = clone $this;
165 $clone->lead = (string) $text;
166 return $clone;
167 }
168
172 public function withNoLead()
173 {
174 $clone = clone $this;
175 $clone->lead = null;
176 return $clone;
177 }
178
182 public function getLead()
183 {
184 return $this->lead;
185 }
186}
An exception for terminatinating execution or to throw for unit testing.
Common interface to all items.
Definition: Item.php:14
withLeadIcon(\ILIAS\UI\Component\Icon\Icon $icon)
Definition: Item.php:151
withLeadImage(\ILIAS\UI\Component\Image\Image $image)
Definition: Item.php:141
withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
Definition: Item.php:104
withColor(\ILIAS\Data\Color $color)
Definition: Item.php:122
A component is the most general form of an entity in the UI.
Definition: Component.php:14
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
trait ComponentHelper
Provides common functionality for component implementations.
Class BaseForm.
Class Factory.
$text
Definition: errorreport.php:18