ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Group.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 use ILIAS\UI\Component\Input\ViewControl\Group as ViewControlGroupInterface;
35 
39 class 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 }
Describes the monoid operation of grouping view control inputs.
Definition: Group.php:29
setInputs(array $inputs)
This setter should be used instead of accessing $this->inputs directly.
Definition: Group.php:163
nameInputs(NameSource $source, string $parent_name)
Definition: Group.php:116
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
_isClientSideValueOk($value)
ATTENTION: This is not the same as.
Definition: Group.php:131
withNameFrom(NameSource $source, ?string $parent_name=null)
Definition: Input.php:200
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:30
string $error
This is an error on the input as displayed client side.
Definition: Input.php:57
getContent()
Get the current content of the input.
Definition: Group.php:68
withNameFrom(NameSource $source, ?string $parent_name=null)
__construct(Container $dic, ilPlugin $plugin)
__construct(DataFactory $data_factory, Refinery $refinery, protected Language $language, array $inputs,)
Definition: Group.php:43
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