ILIAS  release_8 Revision v8.24
with_description.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
7function with_description(): string
8{
9 global $DIC;
10 $tc = $DIC->ui()->factory()->toast()->container();
11
12 $toasts = [
13 $DIC->ui()->factory()->toast()->standard(
14 'Example',
15 $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test')
16 )->withDescription('This is an example description.')
17 ];
18
19 $toasts = base64_encode($DIC->ui()->renderer()->renderAsync($toasts));
20 $button = $DIC->ui()->factory()->button()->standard($DIC->language()->txt('show'), '');
21 $button = $button->withAdditionalOnLoadCode(function ($id) use ($toasts) {
22 return "$id.addEventListener('click', () => {
23 $id.parentNode.querySelector('.il-toast-container').innerHTML = atob('$toasts');
24 $id.parentNode.querySelector('.il-toast-container').querySelectorAll('script').forEach(element => {
25 let newScript = document.createElement('script');
26 newScript.innerHTML = element.innerHTML;
27 element.parentNode.appendChild(newScript);
28 })
29 });";
30 });
31
32 return $DIC->ui()->renderer()->render([$button,$tc]);
33}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $DIC
Definition: feed.php:28