ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Group.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
23 use ILIAS\UI\Component\Input\ViewControl\Group as ViewControlGroupInterface;
33 
37 class Group extends ViewControlInput implements ViewControlGroupInterface, GroupInternal
38 {
39  use GroupInternals;
40 
41  public function __construct(
42  DataFactory $data_factory,
44  protected \ilLanguage $language,
45  array $inputs,
46  ) {
47  parent::__construct($data_factory, $refinery);
48  $this->checkInputListElements('inputs', $inputs, [ViewControlInputInterface::class]);
49  $this->setInputs($inputs);
50  }
51 
55  public function withNameFrom(NameSource $source, ?string $parent_name = null): self
56  {
58  $clone = parent::withNameFrom($source, $parent_name);
59  $clone->setInputs($this->nameInputs($source, $clone->getName()));
60  return $clone;
61  }
62 
66  public function getContent(): Result
67  {
68  if (empty($this->getInputs())) {
69  return new Ok([]);
70  }
71  return parent::getContent();
72  }
73 
74  public function withOnChange(Signal $change_signal): self
75  {
76  $clone = parent::withOnChange($change_signal);
77  $clone->setInputs(array_map(static fn($i) => $i->withOnChange($change_signal), $clone->getInputs()));
78  return $clone;
79  }
80 
84  protected function setError(string $error): void
85  {
86  $this->error = $error;
87  }
88 
89  protected function getLanguage(): \ilLanguage
90  {
91  return $this->language;
92  }
93 
94  protected function getDataFactory(): DataFactory
95  {
96  return $this->data_factory;
97  }
98 
100  protected function isClientSideValueOk($value): bool
101  {
102  return $this->_isClientSideValueOk($value);
103  }
104 }
Describes the monoid operation of grouping view control inputs.
Definition: Group.php:28
setInputs(array $inputs)
This setter should be used instead of accessing $this->inputs directly.
Definition: Group.php:160
__construct(DataFactory $data_factory, Refinery $refinery, protected \ilLanguage $language, array $inputs,)
Definition: Group.php:41
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:14
nameInputs(NameSource $source, string $parent_name)
Definition: Group.php:113
_isClientSideValueOk($value)
ATTENTION: This is not the same as.
Definition: Group.php:128
__construct(VocabulariesInterface $vocabularies)
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:16
getContent()
Get the current content of the input.
Definition: Group.php:66
withNameFrom(NameSource $source, ?string $parent_name=null)
ilErrorHandling $error
Definition: class.ilias.php:55
Describes a source for input names.
Definition: NameSource.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
Refinery Factory $refinery