19declare(strict_types=1);
31use InvalidArgumentException;
45 DataFactory $data_factory,
50 ?
string $byline =
null
52 $this->checkArgListElements(
'inputs',
$inputs, [
I\Group::class]);
61 if ($this->requirement_constraint !==
null) {
62 return $this->requirement_constraint;
71 if (is_string($value) || is_int($value)) {
72 return array_key_exists($value, $this->
getInputs());
74 if (!is_array($value)) {
77 [$key, $group_value] = $value;
78 if (!array_key_exists($key, $this->
getInputs())) {
81 return $this->inputs[$key]->isClientSideValueOk($group_value);
97 $this->checkArg(
'value', $this->
isClientSideValueOk($value),
'Display value does not match input type.');
98 if (is_string($value) || is_int($value)) {
102 [$key, $group_value] = $value;
105 $clone->setInputs($clone->getInputsWithOperationForKey($key, fn($i) => $i->withValue($group_value)));
119 $input = $this->
getInputs()[$key] ??
null;
120 if (
null === $input) {
124 return [$key, $input->getValue()];
132 if ($this->
getName() ===
null) {
133 throw new LogicException(
"Can only collect if input has a name.");
137 $clone = clone $this;
141 $clone->content = $clone->data_factory->error($this->
lng->txt(
"ui_error_switchable_group_required"));
142 return $clone->withError(
"" . $clone->content->error());
145 $clone->content = $clone->data_factory->ok([$key, []]);
150 $clone = $clone->withValue($key);
151 $clone->setInputs($clone->getInputsWithOperationForKey($key, fn($i) => $i->withInput($input)));
156 if (!array_key_exists($key,
$inputs)) {
157 $clone->content = $clone->data_factory->ok([$key, []]);
162 $clone->content = $clone->data_factory->error($this->
lng->txt(
"ui_error_in_group"));
168 $content = $group_input->getContent();
169 if ($content->isOK()) {
170 $contents[$subkey] = $content->value();
175 if ($clone->content->isError()) {
176 return $clone->withError(
"" . $clone->content->error());
190 if (!array_key_exists($key,
$inputs)) {
191 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.