ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 31 of file expandable2.php.

References $data, $DIC, Vendor\Package\$f, $factory, and DataNode\getChildren().

32 {
33  global $DIC;
34  $f = $DIC->ui()->factory();
35  $renderer = $DIC->ui()->renderer();
36 
37 
38  $n11 = new DataNode('1.1');
39  $n12 = new DataNode('1.2', array(new DataNode('1.2.1')));
40  $n1 = new DataNode('1', [$n11, $n12]);
41  $data = [$n1];
42 
43  $recursion = new class implements \ILIAS\UI\Component\Tree\TreeRecursion {
44  public function getChildren($record, $environment = null) : array
45  {
46  return $record->getChildren();
47  }
48 
49  public function build(
50  \ILIAS\UI\Component\Tree\Node\Factory $factory,
51  $record,
52  $environment = null
53  ) : \ILIAS\UI\Component\Tree\Node\Node {
54  return $factory->simple($record->getLabel());
55  }
56  };
57 
58  $tree = $f->tree()->expandable("Label", $recursion)
59  ->withData($data);
60 
61  return $renderer->render($tree);
62 }
Class Factory.
$data
Definition: storeScorm.php:23
Class ChatMainBarProvider .
global $DIC
Definition: goto.php:24
$factory
Definition: metadata.php:58
+ Here is the call graph for this function: