3{
6 $renderer =
$DIC->ui()->renderer();
7
8 $async_close =
$_SERVER[
'REQUEST_URI'] .
'&close_item=true';
9 $async_replace_url =
$_SERVER[
'REQUEST_URI'] .
'&async_load_replace=true';
10 $async_replace_content_load_url =
$_SERVER[
'REQUEST_URI'] .
'&async_load_replace_content=true';
11
12
13 $icon =
$f->symbol()->icon()->standard(
"chtr",
"chtr");
14 $title =
$f->link()->standard(
"Some Title",
"#");
15 $item =
$f->item()->notification($title, $icon)->withCloseAction($async_close);
16
17 $async_item = $item->withAggregateNotifications([$item->withDescription("Original Item")]);
18
19 if (
$_GET[
'async_load_replace']) {
20 $replacement = $async_item
21 ->withDescription("The Item has been replaced Async.")
22 ->withAggregateNotifications([$item->withDescription("This is a freshly async delivered Item.")
23 ,$item->withDescription("And a second one")]);
24 echo $renderer->renderAsync([$replacement]);
26 }
27
28 if (
$_GET[
'async_load_replace_content']) {
29 $replacement = $async_item
30 ->withDescription("The content of the Item has been replaced Async.")
31 ->withAggregateNotifications([$item->withDescription("You will never see this")]);
32 echo $renderer->renderAsync($replacement);
34 }
35
36 $async_replace = $async_item
37 ->withDescription("The complete Item will be replaced Async")
38 ->withAdditionalOnLoadCode(function ($id) use ($async_replace_url) {
39 return "
40 var item = il.UI.item.notification.getNotificationItemObject($($id));
41 item.replaceByAsyncItem('$async_replace_url',{});
42 ";
43 });
44
45 $async_replace_content = $async_item
46 ->withDescription("The content of the Item will be replaced Async")
47 ->withAdditionalOnLoadCode(function ($id) use ($async_replace_content_load_url) {
48 return "
49 var item = il.UI.item.notification.getNotificationItemObject($($id));
50 item.replaceContentByAsyncItemContent('$async_replace_content_load_url',{});
51 ";
52 });
53
54 return $renderer->render([$async_replace,$async_replace_content]);
55}