ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
simpleWithLink.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 function simpleWithLink()
8 {
9  global $DIC;
10  $factory = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12 
13  $icon = $factory->symbol()
14  ->icon()
15  ->standard("crs", 'Example');
16 
17  $node1 = $factory->tree()
18  ->node()
19  ->simple('label');
20 
21 
22  $uri = new \ILIAS\Data\URI('https://ilias.de');
23 
24  $node2 = $factory->tree()
25  ->node()
26  ->simple('label', $icon, $uri);
27 
28  $data = [['node' => $node1], ['node' => $node2]];
29 
30  $recursion = new class () implements \ILIAS\UI\Component\Tree\TreeRecursion {
31  public function getChildren($record, $environment = null): array
32  {
33  return [];
34  }
35 
36  public function build(
37  \ILIAS\UI\Component\Tree\Node\Factory $factory,
38  $record,
39  $environment = null
41  return $record['node'];
42  }
43  };
44 
45  $tree = $factory->tree()->expandable('Label', $recursion)
46  ->withData($data);
47 
48  return $renderer->render([$tree]);
49 }
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.
Definition: Node.php:30
global $DIC
Definition: feed.php:28