This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
However, note that this task is done by the global screen. Currently, devs. will not come in contact with the Component outside the Global Screen.
Note, there is an extended example featuring async calls in the Main Controls Meta Bar Section
12{
14 $f =
$DIC->ui()->factory();
15 $renderer =
$DIC->ui()->renderer();
16
17
18
19 $mail_icon =
$f->symbol()->icon()->standard(
"mail",
"mail");
20 $mail_title =
$f->link()->standard(
"Inbox",
"link_to_inbox");
21 $mail_notification_item =
$f->item()->notification($mail_title, $mail_icon)
22 ->withDescription("You have 23 unread mails in your inbox")
23 ->withProperties(["Time" => "3 days ago"])
24 ->withAdditionalContent(
$f->legacy(
"<b>Additional Content</b>"));
25
26
27 $close_url =
$_SERVER[
'REQUEST_URI'] .
'&badge_closed=true';
28 if (
$_GET[
'badge_closed']) {
29
31 } else {
32 $badge_icon =
$f->symbol()->icon()->standard(
"bdga",
"mail");
33 $badge_title =
$f->link()->standard(
"Badges",
"link_to_achievement_badges");
34 $badge_notification_item1 =
$f->item()->notification($badge_title, $badge_icon)
35 ->withDescription("You received 1 Badge.")
36 ->withProperties(["Time" => "2 days ago"])
37 ->withCloseAction($close_url);
38 $badge_icon =
$f->symbol()->icon()->standard(
"bdga",
"mail");
39 $badge_title =
$f->link()->standard(
"Badges 2",
"link_to_achievement_badges");
40 $close_url =
$_SERVER[
'REQUEST_URI'] .
'&badge_closed=true';
41 $badge_notification_item2 =
$f->item()->notification($badge_title, $badge_icon)
42 ->withDescription("You received 1 Badge.")
43 ->withProperties(["Time" => "2 days ago"])
44 ->withCloseAction($close_url);
45 }
46
47 $generic_icon1 =
$f->symbol()->icon()->standard(
"cal",
"generic");
48 $generic_title1 =
$f->link()->standard(
"Generic 1",
"link_to_generic_repo");
49 $generic_item1 =
$f->item()->notification($generic_title1, $generic_icon1)
50 ->withDescription("Some description.")
51 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
52 ->withActions(
53 $f->dropdown()->standard([
54 $f->button()->shy(
"Possible Action of this Item",
"https://www.ilias.de"),
55 $f->button()->shy(
"Other Possible Action of this Item",
"https://www.github.com")
56 ])
57 );
58 $generic_item1_with_aggregates = $generic_item1->withAggregateNotifications([$mail_notification_item]);
59 $generic_title2 =
$f->link()->standard(
"Generic 2",
"just_opens_the_list_of_aggregates");
60 $generic_item2 =
$f->item()->notification($generic_title2, $generic_icon1)
61 ->withDescription("Some description describing the aggregates attached.")
62 ->withProperties(["Property 1" => "Content 1", "Property 2" => "Content 2"])
63 ->withAggregateNotifications([$generic_item1, $generic_item1]);
64
65
66 $mail_slate =
$f->mainControls()->slate()->notification(
"Mail", [$mail_notification_item]);
67 $badge_slate =
$f->mainControls()->slate()->notification(
"Badge", [$badge_notification_item1, $badge_notification_item2]);
68 $generic_slate =
$f->mainControls()->slate()->notification(
"Generic", [
69 $generic_item1_with_aggregates,
70 $generic_item2
71 ]);
72
73
74 $notification_center =
$f->mainControls()->slate()->combined(
75 "Notification Center",
76 $f->symbol()->icon()->standard(
"notification",
"notification")
77 )
78 ->withEngaged(true)
79 ->withAdditionalEntry($mail_slate)
80 ->withAdditionalEntry($badge_slate)
81 ->withAdditionalEntry($generic_slate);
82 return $renderer->render($notification_center);
83}