ILIAS  release_8 Revision v8.24
Group.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
21
23use ILIAS\UI\Component\Input\ViewControl\Group as ViewControlGroupInterface;
28use ILIAS\Refinery\Factory as Refinery;
29use ILIAS\Data\Factory as DataFactory;
33
37class Group extends ViewControlInput implements ViewControlGroupInterface, GroupInternal
38{
39 use GroupInternals;
40
41 protected \ilLanguage $language;
42
43 public function __construct(
44 DataFactory $data_factory,
45 Refinery $refinery,
46 \ilLanguage $language,
47 array $inputs
48 ) {
49 parent::__construct($data_factory, $refinery);
50 $this->language = $language;
51 $this->checkInputListElements('inputs', $inputs, [ViewControlInputInterface::class]);
52 $this->setInputs($inputs);
53 }
54
58 public function withNameFrom(NameSource $source, ?string $parent_name = null): self
59 {
61 $clone = parent::withNameFrom($source, $parent_name);
62 $clone->setInputs($this->nameInputs($source, $clone->getName()));
63 return $clone;
64 }
65
69 public function getContent(): Result
70 {
71 if (empty($this->getInputs())) {
72 return new Ok([]);
73 }
74 return parent::getContent();
75 }
76
77 public function withOnChange(Signal $change_signal): self
78 {
79 $clone = parent::withOnChange($change_signal);
80 $clone->setInputs(array_map(static fn ($i) => $i->withOnChange($change_signal), $clone->getInputs()));
81 return $clone;
82 }
83
87 protected function setError(string $error): void
88 {
89 $this->error = $error;
90 }
91
92 protected function getLanguage(): \ilLanguage
93 {
94 return $this->language;
95 }
96
97 protected function getDataFactory(): DataFactory
98 {
99 return $this->data_factory;
100 }
101
103 protected function isClientSideValueOk($value): bool
104 {
105 return $this->_isClientSideValueOk($value);
106 }
107}
Builds data types.
Definition: Factory.php:21
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:17
__construct(DataFactory $data_factory, Refinery $refinery, \ilLanguage $language, array $inputs)
Definition: Group.php:43
getContent()
Get the current content of the input.
Definition: Group.php:69
ilErrorHandling $error
Definition: class.ilias.php:55
error(string $a_errmsg)
language handling
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:15
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:37
This describes commonalities between all inputs.
Definition: Input.php:49
Describes the monoid operation of grouping view control inputs.
Definition: Group.php:29
Describes a source for input names.
Definition: NameSource.php:27
$i
Definition: metadata.php:41
$source
Definition: metadata.php:93
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Refinery Factory $refinery
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:114
_isClientSideValueOk($value)
ATTENTION: This is not the same as.
Definition: Group.php:129
setInputs(array $inputs)
This setter should be used instead of accessing $this->inputs directly.
Definition: Group.php:161