ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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;
19  protected $title;
20 
24  protected $desc;
25 
29  protected $props;
30 
34  protected $actions;
35 
39  protected $lead = null;
40 
45  public function __construct($title)
46  {
47  if (!$title instanceof \ILIAS\UI\Component\Button\Shy &&
48  !$title instanceof \ILIAS\UI\Component\Link\Link) {
49  $this->checkStringArg("title", $title);
50  }
51  $this->title = $title;
52  $this->props = [];
53  }
54 
58  public function getTitle()
59  {
60  return $this->title;
61  }
62 
66  public function withDescription(string $desc) : C\Item\Item
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 }
Class Factory.
Class ChatMainBarProvider .
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
__construct($title)
Item constructor.
Definition: Item.php:45
withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
Definition: Item.php:103