ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TreeSelect.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 public function __construct(
34 Language $language,
35 DataFactory $data_factory,
37 C\Input\Container\Form\FormInput $dynamic_input_template,
38 protected C\Input\Field\Node\NodeRetrieval $node_retrieval,
39 string $label,
40 ?string $byline = null
41 ) {
43 $language,
44 $data_factory,
46 $dynamic_input_template,
47 $label,
48 $byline
49 );
50 }
51
52 public function getNodeRetrieval(): C\Input\Field\Node\NodeRetrieval
53 {
54 return $this->node_retrieval;
55 }
56
57 public function getUpdateOnLoadCode(): \Closure
58 {
59 return static fn($id) => '';
60 }
61
63 {
64 if ($this->requirement_constraint !== null) {
65 return $this->requirement_constraint;
66 }
67
68 return $this->refinery->logical()->logicalOr([
69 $this->refinery->numeric()->isNumeric(),
70 $this->refinery->string()->hasMinLength(1),
71 ])->withProblemBuilder(fn($txt, $value) => sprintf($txt('not_greater_than'), 0));
72 }
73
74 protected function isClientSideValueOk($value): bool
75 {
76 if (is_null($value)) {
77 return parent::isClientSideValueOk($value);
78 }
79 if (!is_string($value) && !is_int($value)) {
80 return false;
81 }
82 return parent::isClientSideValueOk($value);
83 }
84}
$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)
Definition: TreeSelect.php:33
This implements commonalities between inputs.
Definition: Input.php:43
$txt
Definition: error.php:31
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