3 declare(strict_types=1);
20 $f = $DIC->ui()->factory();
24 [
'label' =>
'root',
'children' => [
25 [
'label' =>
'1',
'children' => [
26 [
'label' =>
'1.1',
'children' => [
27 [
'label' =>
'1.1.1',
'children' => []],
28 [
'label' =>
'1.1.2',
'children' => []]
30 [
'label' =>
'1.2',
'children' => []],
31 [
'label' =>
'1.3',
'children' => []]
33 [
'label' =>
'2',
'children' => [
34 [
'label' =>
'2.1',
'children' => []],
36 [
'label' =>
'3',
'children' => [
37 [
'label' =>
'3.1',
'children' => [
38 [
'label' =>
'3.1.1',
'children' => [
39 [
'label' =>
'3.1.1.1',
'children' => []],
48 public function getChildren($record, $environment = null): array
50 return $record[
'children'];
53 public function build(
57 ): \ILIAS\UI\Component\Tree\Node\Node {
58 $label = $record[
'label'];
59 $node = $factory->simple($label);
61 if (count($record[
'children']) === 0) {
62 $node = $node->withOnClick($environment[
'modal']->getShowSignal());
65 if ($label ===
"root" || $label ===
"2") {
66 $node = $node->withExpanded(
true);
69 $node = $node->withHighlighted(
true);
76 $image =
$f->image()->responsive(
"assets/ui-examples/images/Image/mountains.jpg",
"Image source: https://stocksnap.io, Creative Commons CC0 license");
77 $page =
$f->modal()->lightboxImagePage($image,
'Mountains');
78 $modal =
$f->modal()->lightbox($page);
83 $tree =
$f->tree()->expandable(
"Label", $recursion)
84 ->withEnvironment($environment)
86 ->withHighlightOnNodeClick(
true);
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This is how the factory for UI elements looks.
expandable()
description: > Example for rendering an expandable tree.