ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StandardNotificationRenderer.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\GlobalScreen\Client\Notifications as ClientNotifications;
25use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
28
34{
35 use Hasher;
36
42 {
43 $ui_notification_item = $item->getNotificationItem();
44
45 if ($item->hasClosedCallable()) {
46 return $this->attachJSCloseEvent($ui_notification_item, $item);
47 }
48
49 return $ui_notification_item;
50 }
51
59 protected function attachJSCloseEvent(Notification $ui_notification_item, isItem $item): Notification
60 {
61 $url = ClientNotifications::NOTIFY_ENDPOINT . "?" . $this->buildCloseQuery($item);
62
63 return $ui_notification_item->withCloseAction($url);
64 }
65}
attachJSCloseEvent(Notification $ui_notification_item, isItem $item)
Attaches on load code for communicating back, that the notification has been closed.
Interface NotificationRenderer Every Notification should have a renderer, if you won't provide on in ...
A component is the most general form of an entity in the UI.
Definition: Component.php:28
withCloseAction(string $url)
Get an Item like this with an url to consulted async, when to close button is pressed.
$url
Definition: shib_logout.php:68