ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DependantGroupHelper.php
Go to the documentation of this file.
1<?php
2
4
6
11{
12
16 protected $dependant_group = null;
17
18 use GroupHelper;
19
23 public function withDependantGroup(C\Input\Field\DependantGroup $dependant_group) : C\Input\Field\Input
24 {
25 $clone = clone $this;
30 $clone = $clone->withOnChange($dependant_group->getToggleSignal());
31 $clone = $clone->appendOnLoad($dependant_group->getInitSignal());
32
33 $clone->inputs["dependant_group"] = $dependant_group;
34
35 return $clone;
36 }
37
41 public function getDependantGroup()
42 {
43 if (is_array($this->inputs) && array_key_exists("dependant_group", $this->inputs)) {
44 return $this->inputs["dependant_group"];
45 } else {
46 return null;
47 }
48 }
49
53 public function appendOnLoad(C\Signal $signal)
54 {
55 return $this->appendTriggeredSignal($signal, 'load');
56 }
57
61 public function withOnChange(C\Signal $signal)
62 {
63 return $this->withTriggeredSignal($signal, 'change');
64 }
65
69 public function appendOnChange(C\Signal $signal)
70 {
71 return $this->appendTriggeredSignal($signal, 'change');
72 }
73
77 public function withOnLoad(C\Signal $signal)
78 {
79 return $this->withTriggeredSignal($signal, 'load');
80 }
81}
An exception for terminatinating execution or to throw for unit testing.
This describes dependant group inputs.
This describes commonalities between all inputs.
Definition: Input.php:31
trait GroupHelper
The code of Group is used in Checkbox, e.g., but a checkbox is not a group.
Definition: GroupHelper.php:22
trait DependantGroupHelper
This is a trait for inputs providing dependant groups, such as checkboxes, e.g.
withTriggeredSignal(Component\Signal $signal, $event)
Add a triggered signal, replacing any other signals registered on the same event.
Definition: Triggerer.php:48
appendTriggeredSignal(Component\Signal $signal, $event)
Append a triggered signal to other signals of the same event.
Definition: Triggerer.php:31