ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TreeMultiSelect.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
21
25use ILIAS\Refinery\Factory as Refinery;
26use ILIAS\Data\Factory as DataFactory;
27
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,
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
77 {
78 if ($this->requirement_constraint !== null) {
79 return $this->requirement_constraint;
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 }
98 return parent::isClientSideValueOk($value);
99 }
100}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Builds data types.
Definition: Factory.php:36
This implements commonalities between all forms.
Definition: Form.php:34
Describes an Input Field which dynamically generates inputs according to a template.
__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 implements commonalities between inputs.
Definition: Input.php:43
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
This describes inputs that can be used in forms.
Definition: FormInput.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Checkbox.php:21