ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
expandable2.php File Reference

Go to the source code of this file.

Data Structures

class  DataNode
 

Functions

 expandable2 ()
 

Function Documentation

◆ expandable2()

expandable2 ( )

Definition at line 21 of file expandable2.php.

22{
23 global $DIC;
24 $f = $DIC->ui()->factory();
25 $renderer = $DIC->ui()->renderer();
26
27
28 $n11 = new DataNode('1.1');
29 $n12 = new DataNode('1.2', array(new DataNode('1.2.1')));
30 $n1 = new DataNode('1', [$n11, $n12]);
31 $data = [$n1];
32
33 $recursion = new class implements \ILIAS\UI\Component\Tree\TreeRecursion {
34 public function getChildren($record, $environment = null) : array
35 {
36 return $record->getChildren();
37 }
38
39 public function build(
40 \ILIAS\UI\Component\Tree\Node\Factory $factory,
41 $record,
42 $environment = null
43 ) : \ILIAS\UI\Component\Tree\Node\Node {
44 return $factory->simple($record->getLabel());
45 }
46 };
47
48 $tree = $f->tree()->expandable("Label", $recursion)
49 ->withData($data);
50
51 return $renderer->render($tree);
52}
$factory
Definition: metadata.php:58
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
simple()
Definition: simple.php:2
$data
Definition: storeScorm.php:23
$DIC
Definition: xapitoken.php:46

References $data, $DIC, Vendor\Package\$f, and $factory.