19declare(strict_types=1);
32use InvalidArgumentException;
46 DataFactory $data_factory,
51 ?
string $byline =
null
53 $this->checkArgListElements(
'inputs',
$inputs, [
I\Group::class]);
62 if ($this->requirement_constraint !==
null) {
63 return $this->requirement_constraint;
72 if (is_string($value) || is_int($value)) {
73 return array_key_exists($value, $this->
getInputs());
75 if (!is_array($value)) {
78 [$key, $group_value] = $value;
79 if (!array_key_exists($key, $this->
getInputs())) {
82 return $this->inputs[$key]->isClientSideValueOk($group_value);
98 $this->checkArg(
'value',
null === $value || $this->
isClientSideValueOk($value),
'Display value does not match input type.');
99 if (
null === $value || is_string($value) || is_int($value)) {
103 [$key, $group_value] = $value;
106 $clone->setInputs($clone->getInputsWithOperationForKey($key, fn($i) => $i->withValue($group_value)));
120 $input = $this->
getInputs()[$key] ??
null;
121 if (
null === $input) {
125 return [$key, $input->getValue()];
133 if ($this->
getName() ===
null) {
134 throw new LogicException(
"Can only collect if input has a name.");
138 $clone = clone $this;
142 $clone->content = $clone->data_factory->error($this->
lng->txt(
"ui_error_switchable_group_required"));
143 return $clone->withError(
"" . $clone->content->error());
146 $clone->content = $clone->data_factory->ok([$key, []]);
151 $clone = $clone->withValue($key);
152 $clone->setInputs($clone->getInputsWithOperationForKey($key, fn($i) => $i->withInput($input)));
157 if (!array_key_exists($key,
$inputs)) {
158 $clone->content = $clone->data_factory->ok([$key, []]);
163 $clone->content = $clone->data_factory->error($this->
lng->txt(
"ui_error_in_group"));
169 $content = $group_input->getContent();
170 if ($content->isOK()) {
176 if ($clone->content->isError()) {
177 return $clone->withError(
"" . $clone->content->error());
191 if (!array_key_exists($key,
$inputs)) {
192 throw new LogicException(
"Key '$key' does not exist in inputs.");
A constraint encodes some resrtictions on values.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.