19 declare(strict_types=1);
37 if (!$component instanceof
Node\
Node) {
41 $tpl_name =
"tpl.node.html";
46 $tpl->setVariable(
"ASYNCURL", $component->getAsyncURL());
50 $icon = $component->getIcon();
51 $label = $component->getLabel();
53 if (!is_null($icon) && $icon->getLabel() === $label) {
58 $link = $component->getLink();
61 $linkAsString = $link->__toString();
63 $tpl->setVariable(
"LINK", $linkAsString);
64 $tpl->setVariable(
"LABEL_LINKED", $label);
66 $tpl->setVariable(
"ICON_LINKED", $default_renderer->render($icon));
68 if ($component instanceof Node\
Bylined &&
null !== $component->getByline()) {
69 $tpl->setVariable(
'BYLINE_LINKED', $component->getByline());
70 } elseif ($component instanceof Node\
KeyValue &&
null !== $component->getValue()) {
71 $tpl->setVariable(
'VALUE_LINKED', $component->getValue());
74 $tpl->setCurrentBlock(
"node_without_link");
75 $tpl->setVariable(
"LABEL", $label);
77 $tpl->setVariable(
"ICON", $default_renderer->render($icon));
79 if ($component instanceof Node\
Bylined &&
null !== $component->getByline()) {
80 $tpl->setVariable(
'BYLINE', $component->getByline());
81 } elseif ($component instanceof Node\
KeyValue &&
null !== $component->getValue()) {
82 $tpl->setVariable(
'VALUE', $component->getValue());
86 if ($component->isHighlighted()) {
87 $tpl->touchBlock(
"highlighted");
93 $triggered_signals = $component->getTriggeredSignals();
94 if (count($triggered_signals) > 0) {
95 $component = $this->triggerFurtherSignals($component, $triggered_signals);
100 $tpl->setCurrentBlock(
"li_id");
101 $tpl->setVariable(
"ID",
$id);
102 $tpl->parseCurrentBlock();
106 $subnodes = $component->getSubnodes();
108 if (count($subnodes) > 0 || $async) {
109 $tpl->touchBlock(
"expandable");
110 $tpl->setCurrentBlock(
"aria_expanded");
111 if ($component->isExpanded()) {
112 $tpl->setVariable(
"ARIA_EXPANDED",
"true");
114 $tpl->setVariable(
"ARIA_EXPANDED",
"false");
116 $tpl->parseCurrentBlock();
118 $subnodes_html = $default_renderer->render($subnodes);
119 $tpl->setVariable(
"SUBNODES", $subnodes_html);
122 if ($async || $link ===
null || count($subnodes) !== 0) {
123 $tpl->touchBlock(
"role_item");
125 $tpl->touchBlock(
"role_none");
136 protected function triggerFurtherSignals(
138 array $triggered_signals
141 foreach ($triggered_signals as $s) {
146 "signal_id" => $s->getSignal()->getId(),
147 "event" => $s->getEvent(),
148 "options" => $s->getSignal()->getOptions()
151 $signals = json_encode($signals);
153 return $component->withAdditionalOnLoadCode(fn(
$id) =>
" 154 $('#$id > span').click(function(e){ 155 var node = $('#$id'), 158 for (var i = 0; i < signals.length; i++) { 160 node.trigger(s.signal_id, s);
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
This describes a Tree Node.
This describes a Tree Node.
This describes a tree node with an byline providing additional information about this node...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This describes a tree node in which the label is complemented by an additional string, forming a key-value pair.
getAsyncLoading()
Should this node load its children asynchronously?
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.