ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
with_disabled.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
11 
24 function with_disabled(): 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  yield from [];
45  }
46  };
47 
48  $input = $factory->input()->field()->treeSelect(
49  $node_retrieval,
50  "select a single node",
51  "you should not be able to click the button above!",
52  );
53 
54  $input = $input->withDisabled(true);
55 
56  $form = $factory->input()->container()->form()->standard('#', [$input]);
57 
58  return $renderer->render($form);
59 }
$renderer
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This is how a factory for icons looks like.
Definition: Factory.php:26
global $DIC
Definition: shib_login.php:26
with_disabled()
description: > The example shows how to disable a Tree Select Field.