ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
simple.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
33 function 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
56  ): \ILIAS\UI\Component\Tree\Node\Node {
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
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
simple()
description: > Example for rendering a simple tree node.
Definition: simple.php:33