ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
7 use ILIAS\UI\Component as C;
9 
13 abstract class Item implements C\Item\Item
14 {
15  use ComponentHelper;
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  }
54 
58  public function getTitle()
59  {
60  return $this->title;
61  }
62 
66  public function withDescription($desc)
67  {
68  $this->checkStringArg("description", $desc);
69  $clone = clone $this;
70  $clone->desc = $desc;
71  return $clone;
72  }
73 
77  public function getDescription()
78  {
79  return $this->desc;
80  }
81 
85  public function withProperties(array $props)
86  {
87  $clone = clone $this;
88  $clone->props = $props;
89  return $clone;
90  }
91 
95  public function getProperties()
96  {
97  return $this->props;
98  }
99 
103  public function withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
104  {
105  $clone = clone $this;
106  $clone->actions = $actions;
107  return $clone;
108  }
109 
113  public function getActions()
114  {
115  return $this->actions;
116  }
117 
121  public function withColor(\ILIAS\Data\Color $color)
122  {
123  $clone = clone $this;
124  $clone->color = $color;
125 
126  return $clone;
127  }
128 
132  public function getColor()
133  {
134  return $this->color;
135  }
136 
140  public function withLeadImage(\ILIAS\UI\Component\Image\Image $image)
141  {
142  $clone = clone $this;
143  $clone->lead = $image;
144  return $clone;
145  }
146 
150  public function withLeadText($text)
151  {
152  $this->checkStringArg("lead_text", $text);
153  $clone = clone $this;
154  $clone->lead = (string) $text;
155  return $clone;
156  }
157 
161  public function withNoLead()
162  {
163  $clone = clone $this;
164  $clone->lead = null;
165  return $clone;
166  }
167 
171  public function getLead()
172  {
173  return $this->lead;
174  }
175 }
Add rich text string
withLeadImage(\ILIAS\UI\Component\Image\Image $image)
Definition: Item.php:140
Class Factory.
Class BaseForm.
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
Common interface to all items.
Definition: Item.php:13
$text
Definition: errorreport.php:18
Create styles array
The data for the language used.
withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
Definition: Item.php:103
withColor(\ILIAS\Data\Color $color)
Definition: Item.php:121