ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
simple.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
33function simple()
34{
35 global $DIC;
36 $f = $DIC->ui()->factory();
37 $renderer = $DIC->ui()->renderer();
38
39 $icon = $f->symbol()->icon()->standard("crs", 'Example');
40
41 $node1 = $f->tree()->node()->simple('label');
42 $node2 = $f->tree()->node()->simple('label', $icon);
43
44 $data = [['node' => $node1], ['node' => $node2]];
45
46 $recursion = new class () implements \ILIAS\UI\Component\Tree\TreeRecursion {
47 public function getChildren($record, $environment = null): array
48 {
49 return [];
50 }
51
52 public function build(
53 \ILIAS\UI\Component\Tree\Node\Factory $factory,
54 $record,
55 $environment = null
57 return $record['node'];
58 }
59 };
60
61 $tree = $f->tree()->expandable('Label', $recursion)
62 ->withData($data);
63
64 return $renderer->render($tree);
65}
$renderer
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Definition: UI.php:24
This describes a Tree Node.
Definition: Node.php:31
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26