19 declare(strict_types=1);
40 $tpl_name =
"tpl.tree.html";
43 $tpl->setVariable(
"ARIA_LABEL", $component->getLabel());
46 foreach ($component->getData() as $record) {
48 $component->getRecursion(),
50 $component->getEnvironment()
54 $nodes_html = $default_renderer->render($nodes);
56 if ($component->isSubTree()) {
60 $tpl->setVariable(
'NODES', $nodes_html);
62 $highlight_node_on_click = $component->getHighlightOnNodeClick();
63 $component = $component->withAdditionalOnLoadCode(
64 fn(
$id) =>
"il.UI.tree.init('$id', $highlight_node_on_click)" 68 $tpl->setVariable(
"ID",
$id);
83 $node = $recursion->build(
89 foreach ($recursion->getChildren($record, $environment) as $sub_record) {
90 $node = $node->withAdditionalSubnode(
91 $this->
buildNode($recursion, $sub_record, $environment)
103 parent::registerResources($registry);
104 $registry->
register(
'assets/js/tree.js');
Registry for resources required by rendered output like Javascript or CSS.
This describes a Tree Control.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
render(Component\Component $component, RendererInterface $default_renderer)
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
register(string $name)
Add a dependency.
This describes a Tree Control.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Interface for mapping data-structures to the Tree.
getUIFactory()
Get a UI factory.
buildNode(Tree\TreeRecursion $recursion, $record, $environment)
Trigger TreeRecursion::build and recurse into hierarchy by checking for further children of the recor...
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.