19declare(strict_types=1);
29use ILIAS\UI\Implementation\Component\ComponentHelper;
36use InvalidArgumentException;
79 protected DataFactory $data_factory,
104 $clone = clone $this;
129 $clone = clone $this;
147 $clone = clone $this;
148 $clone->setAdditionalTransformation($trafo);
160 $this->operations[] = $trafo;
161 if ($this->content !==
null) {
162 if (!$this->content->isError()) {
163 $this->content = $trafo->
applyTo($this->content);
165 if ($this->content->isError()) {
166 $this->
setError($this->content->error());
176 return $this->dedicated_name;
184 $clone = clone $this;
185 $clone->dedicated_name = $dedicated_name;
202 $clone = clone $this;
206 $clone->name = ($parent_name !==
null) ? $parent_name .
'/' :
'';
208 $clone->name .= ($clone->dedicated_name !==
null)
209 ? $source->getNewDedicatedName($clone->dedicated_name)
222 if ($this->
getName() ===
null) {
223 throw new LogicException(
"Can only collect if input has a name.");
238 if ($clone->content->isError()) {
239 $error = $clone->content->error();
240 if (
$error instanceof \Exception) {
243 return $clone->withError(
"" .
$error);
256 $res = $this->data_factory->ok(
$res);
258 if (
$res->isError()) {
274 foreach ($this->operations as $op) {
284 if (is_null($this->content)) {
285 throw new LogicException(
"No content of this field has been evaluated yet. Seems withRequest was not called.");
287 return $this->content;
A result encapsulates a value or an error and simplifies the handling of those.
A constraint encodes some resrtictions on values.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.