ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
with_value.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
11
24function with_value(): string
25{
26 global $DIC;
27
28 $factory = $DIC->ui()->factory();
29 $renderer = $DIC->ui()->renderer();
30
31 $node_retrieval = new class () implements NodeRetrieval {
32 public function getNodes(
33 NodeFactory $node_factory,
34 IconFactory $icon_factory,
35 ?string $parent_id = null,
36 ): \Generator {
37 yield from [];
38 }
39 public function getNodesAsLeaf(
40 NodeFactory $node_factory,
41 IconFactory $icon_factory,
42 array $node_ids,
43 ): \Generator {
44 foreach ($node_ids as $node_id) {
45 yield $node_factory->leaf($node_id, "dummy leaf node $node_id");
46 }
47 }
48 };
49
50 $input = $factory->input()->field()->treeSelect(
51 $node_retrieval,
52 "select a single node",
53 "there should already be a selected node.",
54 );
55
56 $input = $input->withValue('1.1');
57
58 $form = $factory->input()->container()->form()->standard('#', [$input]);
59
60 return $renderer->render($form);
61}
62
$renderer
This is how a factory for icons looks like.
Definition: Factory.php:27
global $DIC
Definition: shib_login.php:26