3 declare(strict_types=1);
41 return $this->
renderToast($component, $default_renderer);
47 throw new LogicException(
"Cannot render: " . get_class($component));
54 $title = $component->getTitle();
55 if ($title instanceof
Shy || $title instanceof
Link) {
56 $title = $default_renderer->render($title);
58 $title = htmlentities($title);
60 $tpl->setVariable(
"TITLE", $title);
62 $tpl->setVariable(
"TOAST_DELAY", $component->getDelayTime());
63 $tpl->setVariable(
"TOAST_VANISH", $component->getVanishTime());
64 $tpl->setVariable(
"VANISH_ASYNC", $component->getAction());
66 $desc = htmlentities($component->getDescription());
67 if (trim($desc) !=
"") {
68 $tpl->setCurrentBlock(
"desc");
69 $tpl->setVariable(
"DESC", $desc);
70 $tpl->parseCurrentBlock();
73 $actions = $component->getLinks();
74 if (!empty($actions)) {
75 foreach ($actions as $action) {
76 $tpl->setCurrentBlock(
"action");
77 $tpl->setVariable(
"ACTION", $default_renderer->render($action));
78 $tpl->parseCurrentBlock();
82 $tpl->setVariable(
"ICON", $default_renderer->render($component->getIcon()));
83 $tpl->setVariable(
"CLOSE", $default_renderer->render($this->getUIFactory()->button()->close()));
85 $component = $component->withAdditionalOnLoadCode(fn (
$id) =>
" 86 il.UI.toast.setToastSettings($id); 87 il.UI.toast.showToast($id); 90 $tpl->setCurrentBlock(
"id");
92 $tpl->parseCurrentBlock();
100 $tpl->setVariable(
"TOASTS", $default_renderer->render($component->getToasts()));
106 parent::registerResources($registry);
107 $registry->
register(
'./src/UI/templates/js/Toast/toast.js');
116 Component\Toast\Toast::class,
117 Component\Toast\Container::class
Registry for resources required by rendered output like Javascript or CSS.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
renderToast(Component\Toast\Toast $component, RendererInterface $default_renderer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderContainer(Component\Toast\Container $component, RendererInterface $default_renderer)
getComponentInterfaceName()
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
register(string $name)
Add a dependency.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
render(Component\Component $component, RendererInterface $default_renderer)
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.