ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Notification.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\UI\Component\Item\Notification as INotification;
26use ILIAS\UI\Component\JavaScriptBindable as IJavaScriptBindable;
31
32class Notification extends Item implements INotification, IJavaScriptBindable
33{
35
36 protected ?Content $additional_content = null;
37 protected Icon $lead_icon;
38 protected ?string $close_action = null;
39
43 protected array $aggregate_notifications = [];
44
49 public function __construct($title, Icon $icon)
50 {
51 $this->lead_icon = $icon;
52 parent::__construct($title);
53 }
54
58 public function withAdditionalContent(Content $additional_content): INotification
59 {
60 $clone = clone $this;
61 $clone->additional_content = $additional_content;
62 return $clone;
63 }
64
68 public function getAdditionalContent(): ?Content
69 {
70 return $this->additional_content;
71 }
72
76 public function withCloseAction(string $url): INotification
77 {
78 $clone = clone $this;
79 $clone->close_action = $url;
80 return $clone;
81 }
82
86 public function getCloseAction(): ?string
87 {
88 return $this->close_action;
89 }
90
94 public function withAggregateNotifications(array $aggregate_notifications): INotification
95 {
96 $classes = [
97 INotification::class
98 ];
99 $this->checkArgListElements("Notification Item", $aggregate_notifications, $classes);
100 $clone = clone $this;
101 $clone->aggregate_notifications = $aggregate_notifications;
102 return $clone;
103 }
104
108 public function getAggregateNotifications(): array
109 {
110 return $this->aggregate_notifications;
111 }
112
116 public function withLeadIcon(Icon $icon): INotification
117 {
118 $clone = clone $this;
119 $clone->lead_icon = $icon;
120 return $clone;
121 }
122
126 public function getLeadIcon(): Icon
127 {
128 return $this->lead_icon;
129 }
130
134 public function withActions(C\Dropdown\Standard $actions): C\Item\Notification
135 {
136 $clone = clone $this;
137 $clone->actions = $actions;
138 return $clone;
139 }
140
144 public function getActions(): ?C\Dropdown\Standard
145 {
146 return $this->actions;
147 }
148}
getLeadIcon()
Get icon as lead.Note that Notifications only accept Icons as lead, this is different from the standa...
getAdditionalContent()
Get the additional content of the item or null.
withAggregateNotifications(array $aggregate_notifications)
Get an Notification Item like this, but with a set of Notifications, this Notification Item will aggr...
getAggregateNotifications()
Get the list of Notification Items, this Notification Item aggregates or an empty list....
withAdditionalContent(Content $additional_content)
Get a Notification Item like this but with additional content bellow the description....
getCloseAction()
Get the url attached to this Notification Item.
withCloseAction(string $url)
Get an Item like this with an url to consulted async, when to close button is pressed....
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:35
Common interface to all items.
Definition: Item.php:32
Interface to be extended by components that have the possibility to bind to Javascript.
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
$url
Definition: shib_logout.php:68