ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
StandardNotificationRenderer.php
Go to the documentation of this file.
2 
3 use ILIAS\GlobalScreen\Client\Notifications as ClientNotifications;
8 
15 {
16  use Hasher;
17 
18 
24  public function getNotificationComponentForItem(isItem $item)
25  {
26  $ui_notification_item = $item->getNotificationItem();
27 
28  if ($item->hasClosedCallable()) {
29  return $this->attachJSCloseEvent($ui_notification_item, $item);
30  }
31 
32  return $ui_notification_item;
33  }
34 
35 
45  protected function attachJSCloseEvent(Notification $ui_notification_item, isItem $item) : Notification
46  {
47  $url = ClientNotifications::NOTIFY_ENDPOINT . "?" . $this->buildCloseQuery($item);
48 
49  return $ui_notification_item->withCloseAction($url);
50  }
51 }
attachJSCloseEvent(Notification $ui_notification_item, isItem $item)
Attaches on load code for communicating back, that the notification has been closed.
$url
withCloseAction(string $url)
Get an Item like this with an url to consulted async, when to close button is pressed.