ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 function base(): string
8 {
9  global $DIC;
10  $tc = $DIC->ui()->factory()->toast()->container();
11 
12  $toasts = [];
13 
14  $toasts = base64_encode($DIC->ui()->renderer()->renderAsync($toasts));
15  $button = $DIC->ui()->factory()->button()->standard($DIC->language()->txt('show'), '');
16  $button = $button->withAdditionalOnLoadCode(function ($id) use ($toasts) {
17  return "$id.addEventListener('click', () => {
18  $id.parentNode.querySelector('.il-toast-container').innerHTML = atob('$toasts');
19  $id.parentNode.querySelector('.il-toast-container').querySelectorAll('script').forEach(element => {
20  let newScript = document.createElement('script');
21  newScript.innerHTML = element.innerHTML;
22  element.parentNode.appendChild(newScript);
23  })
24  });";
25  });
26 
27  return $DIC->ui()->renderer()->render([$button,$tc]);
28 }
global $DIC
Definition: feed.php:28
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23