19 declare(strict_types=1);
44 if ($component instanceof
Menu\
Menu) {
58 $tpl_menu = $this->
getTemplate(
'tpl.menu.html',
true,
true);
60 $label = $component->getLabel();
61 if (!is_string($label)) {
62 $label = $default_renderer->render($label);
64 $tpl_menu->setVariable(
'LABEL', $label);
65 $tpl_menu->setVariable(
'ITEMS', $this->
renderMenuItems($component, $default_renderer));
66 return $tpl_menu->get();
75 $back_signal = $component->getBacklinkSignal();
76 $persistence_id = $component->getPersistenceId();
77 $glyph = $ui_factory->symbol()->glyph()->collapsehorizontal();
78 $btn = $ui_factory->button()->bulky($glyph,
'',
'#')
79 ->withOnClick($back_signal)
80 ->withAriaLabel($this->
txt(
'back'));
81 $back_button_html = $default_renderer->render($btn);
83 $component = $component->withAdditionalOnLoadCode(
84 function (
$id) use ($back_signal, $persistence_id) {
85 $params =
"'$id', '$back_signal'";
86 if (is_null($persistence_id)) {
89 $params .=
", '$persistence_id'";
91 return "il.UI.menu.drilldown.init($params);";
96 $tpl_name =
"tpl.drilldown.html";
98 $tpl->setVariable(
"ID", $id_drilldown);
99 $tpl->setVariable(
'ARIA_LABEL', $component->getLabel());
100 $tpl->setVariable(
'BACKNAV', $back_button_html);
101 $tpl->setVariable(
'DRILLDOWN', $items_html);
102 $tpl->setVariable(
'NO_ITEMS_TEXT', $this->
txt(self::NO_ITEMS_LABEL));
113 foreach ($component->getItems() as $item) {
114 $tpl_item = $this->
getTemplate(
'tpl.menuitem.html',
true,
true);
115 if ($item instanceof
Menu\
Sub) {
116 $tpl_item->setVariable(
'CLASS', self::PARENT_CLASS);
118 $tpl_item->setVariable(
'CLASS', self::LEAF_CLASS);
120 $tpl_item->setVariable(
'ITEM', $default_renderer->render($item));
121 $html .= $tpl_item->get();
132 $template->
setVariable(
'LABEL', sprintf($this->
txt(
'filter_nodes_in'), $component->getLabel()));
142 parent::registerResources($registry);
143 $registry->
register(
'assets/js/drilldown.min.js');
Registry for resources required by rendered output like Javascript or CSS.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
txt(string $id)
Get a text from the language file.
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.
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.
register(string $name)
Add a dependency.
parseCurrentBlock()
Parse the block that is currently worked on.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getUIFactory()
Get a UI factory.
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.