19 declare(strict_types=1);
47 $tpl_name =
"tpl.standard.html";
52 if (is_array($items) && count($items) == 0) {
55 $this->
renderItems($items, $tpl, $default_renderer);
59 if ($label !==
null) {
60 $tpl->setVariable(
"LABEL", $component->
getLabel());
62 $tpl->setVariable(
"LABEL",
"");
70 : $this->
txt(
"actions");
71 $tpl->setCurrentBlock(
"aria_label");
72 $tpl->setVariable(
"ARIA_LABEL", $aria_label);
73 $tpl->parseCurrentBlock();
76 $component = $component->withAdditionalOnLoadCode(
78 "il.UI.dropdown.init(document.getElementById(\"$id\"));" 88 foreach ($items as $item) {
90 $tpl->
setVariable(
"ITEM", $default_renderer->render($item));
114 parent::registerResources($registry);
115 $registry->
register(
'assets/js/dropdown.js');
Registry for resources required by rendered output like Javascript or CSS.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
txt(string $id)
Get a text from the language file.
renderDropdown(Dropdown $component, RendererInterface $default_renderer)
setCurrentBlock(string $name)
Set the block to work on.
createId()
Get a fresh unique id.
setVariable(string $name, $value)
Set a variable in the current block.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
render(Component\Component $component, RendererInterface $default_renderer)
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
renderId(JavaScriptBindable $component, Template $tpl)
register(string $name)
Add a dependency.
parseCurrentBlock()
Parse the block that is currently worked on.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
renderItems(array $items, Template $tpl, RendererInterface $default_renderer)
Base class for all component renderers.
This implements commonalities between different types of Dropdowns.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.