ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Group.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\UI\Component\Input\ViewControl\Group as ViewControlGroupInterface;
30use ILIAS\Refinery\Factory as Refinery;
31use ILIAS\Data\Factory as DataFactory;
35
39class Group extends ViewControlInput implements ViewControlGroupInterface, GroupInternal
40{
41 use GroupInternals;
42
43 public function __construct(
44 DataFactory $data_factory,
46 protected Language $language,
47 array $inputs,
48 ) {
49 parent::__construct($data_factory, $refinery);
50 $this->checkInputListElements('inputs', $inputs, [ViewControlInputInterface::class]);
51 $this->setInputs($inputs);
52 }
53
57 public function withNameFrom(NameSource $source, ?string $parent_name = null): self
58 {
60 $clone = parent::withNameFrom($source, $parent_name);
61 $clone->setInputs($this->nameInputs($source, $clone->getName()));
62 return $clone;
63 }
64
68 public function getContent(): Result
69 {
70 if (empty($this->getInputs())) {
71 return new Ok([]);
72 }
73 return parent::getContent();
74 }
75
76 public function withOnChange(Signal $change_signal): self
77 {
78 $clone = parent::withOnChange($change_signal);
79 $clone->setInputs(array_map(static fn($i) => $i->withOnChange($change_signal), $clone->getInputs()));
80 return $clone;
81 }
82
86 protected function setError(string $error): void
87 {
88 $this->error = $error;
89 }
90
91 protected function getLanguage(): Language
92 {
93 return $this->language;
94 }
95
96 protected function getDataFactory(): DataFactory
97 {
98 return $this->data_factory;
99 }
100
102 protected function isClientSideValueOk($value): bool
103 {
104 return $this->_isClientSideValueOk($value);
105 }
106}
Builds data types.
Definition: Factory.php:36
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:31
__construct(DataFactory $data_factory, Refinery $refinery, protected Language $language, array $inputs,)
Definition: Group.php:43
getContent()
Get the current content of the input.
Definition: Group.php:68
ilErrorHandling $error
Definition: class.ilias.php:69
error(string $a_errmsg)
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29
This describes the basis of all View Control Inputs.
Groups are a special kind of input because they are a monoid operation.
Definition: Group.php:38
This describes commonalities between all inputs.
Definition: Input.php:47
Describes the monoid operation of grouping view control inputs.
Definition: Group.php:30
Describes a source for input names.
Definition: NameSource.php:27
__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: Factory.php:21
withNameFrom(NameSource $source, ?string $parent_name=null)
@inheritDoc
nameInputs(NameSource $source, string $parent_name)
Definition: Group.php:116
_isClientSideValueOk($value)
ATTENTION: This is not the same as.
Definition: Group.php:131
setInputs(array $inputs)
This setter should be used instead of accessing $this->inputs directly.
Definition: Group.php:163