ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
with_value.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
21
26
39function with_value(): string
40{
41 global $DIC;
42
43 $factory = $DIC->ui()->factory();
44 $renderer = $DIC->ui()->renderer();
45
46 $node_retrieval = new class () implements NodeRetrieval {
47 public function getNodes(
48 NodeFactory $node_factory,
49 IconFactory $icon_factory,
50 array $sync_node_id_whitelist = [],
51 ?string $parent_id = null,
52 ): \Generator {
53 yield from $this->getNodesAsLeaf($node_factory, $icon_factory, $sync_node_id_whitelist);
54 }
55 public function getNodesAsLeaf(
56 NodeFactory $node_factory,
57 IconFactory $icon_factory,
58 array $node_ids,
59 ): \Generator {
60 foreach ($node_ids as $node_id) {
61 yield $node_factory->leaf([$node_id], "dummy leaf node $node_id");
62 }
63 }
64 };
65
66 $input = $factory->input()->field()->treeSelect(
67 $node_retrieval,
68 "select a single node",
69 "there should already be a selected node.",
70 );
71
72 $input = $input->withValue('1.1');
73
74 $form = $factory->input()->container()->form()->standard('#', [$input]);
75
76 return $renderer->render($form);
77}
$renderer
This is how a factory for icons looks like.
Definition: Factory.php:27
global $DIC
Definition: shib_login.php:26