3 declare(strict_types=1);
10 $f = $DIC->ui()->factory();
11 $renderer = $DIC->ui()->renderer();
14 [
'label' =>
'root',
'children' => [
15 [
'label' =>
'1',
'children' => [
16 [
'label' =>
'1.1',
'children' => [
17 [
'label' =>
'1.1.1',
'children' => []],
18 [
'label' =>
'1.1.2',
'children' => []]
20 [
'label' =>
'1.2',
'children' => []],
21 [
'label' =>
'1.3',
'children' => []]
23 [
'label' =>
'2',
'children' => [
24 [
'label' =>
'2.1',
'children' => []],
26 [
'label' =>
'3',
'children' => [
27 [
'label' =>
'3.1',
'children' => [
28 [
'label' =>
'3.1.1',
'children' => [
29 [
'label' =>
'3.1.1.1',
'children' => []],
37 $recursion =
new class () implements \
ILIAS\
UI\
Component\Tree\TreeRecursion {
38 public function getChildren($record, $environment = null): array
40 return $record[
'children'];
43 public function build(
48 $label = $record[
'label'];
49 $node = $factory->simple($label);
51 if (count($record[
'children']) === 0) {
52 $node = $node->
withOnClick($environment[
'modal']->getShowSignal());
55 if ($label ===
"root" || $label ===
"2") {
56 $node = $node->withExpanded(
true);
59 $node = $node->withHighlighted(
true);
66 $image =
$f->image()->responsive(
"src/UI/examples/Image/mountains.jpg",
"Image source: https://stocksnap.io, Creative Commons CC0 license");
67 $page =
$f->modal()->lightboxImagePage($image,
'Mountains');
68 $modal =
$f->modal()->lightbox($page);
73 $tree =
$f->tree()->expandable(
"Label", $recursion)
74 ->withEnvironment($environment)
76 ->withHighlightOnNodeClick(
true);
78 return $renderer->render([
withOnClick(Signal $signal)
Get a component like this, triggering a signal of another component on click.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes a Tree Node.