ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
TreeMultiSelect.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
22 use ILIAS\UI\Component as C;
27 
31 class TreeMultiSelect extends HasDynamicInputs implements C\Input\Field\TreeMultiSelect
32 {
33  protected bool $can_select_child_nodes = false;
34 
35  public function __construct(
36  Language $language,
37  DataFactory $data_factory,
39  C\Input\Container\Form\FormInput $dynamic_input_template,
40  protected C\Input\Field\Node\NodeRetrieval $node_retrieval,
41  string $label,
42  ?string $byline = null
43  ) {
45  $language,
46  $data_factory,
47  $refinery,
48  $dynamic_input_template,
49  $label,
50  $byline
51  );
52  }
53 
54  public function withSelectChildNodes(bool $is_allowed): static
55  {
56  $clone = clone $this;
57  $clone->can_select_child_nodes = $is_allowed;
58  return $clone;
59  }
60 
61  public function canSelectChildNodes(): bool
62  {
64  }
65 
66  public function getNodeRetrieval(): C\Input\Field\Node\NodeRetrieval
67  {
68  return $this->node_retrieval;
69  }
70 
71  public function getUpdateOnLoadCode(): \Closure
72  {
73  return static fn($id) => '';
74  }
75 
76  protected function getConstraintForRequirement(): ?Constraint
77  {
78  if ($this->requirement_constraint !== null) {
80  }
81 
82  return $this->refinery->custom()->constraint(
83  static fn($value) => is_array($value) && 1 <= count($value),
84  sprintf($this->language->txt('not_greater_than_or_equal'), 1)
85  );
86  }
87 
88  protected function isClientSideValueOk($value): bool
89  {
90  if (!is_array($value)) {
91  return false;
92  }
93  foreach ($value as $_value) {
94  if (!is_string($_value) && !is_int($_value)) {
95  return false;
96  }
97  }
99  }
100 }
This implements commonalities between inputs.
Definition: Input.php:42
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
This implements commonalities between all forms.
Definition: Form.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Checkbox.php:21
Describes an Input Field which dynamically generates inputs according to a template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(Container $dic, ilPlugin $plugin)
__construct(Language $language, DataFactory $data_factory, Refinery $refinery, C\Input\Container\Form\FormInput $dynamic_input_template, protected C\Input\Field\Node\NodeRetrieval $node_retrieval, string $label, ?string $byline=null)
This describes inputs that can be used in forms.
Definition: FormInput.php:32
language()
description: > Example for rendring a language glyph.
Definition: language.php:41