ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilForumNotificationEventsFormGUI Class Reference
+ Collaboration diagram for ilForumNotificationEventsFormGUI:

Public Member Functions

 __construct (private readonly string $action, private ?array $predefined_values, private readonly \ILIAS\UI\Factory $ui_factory, private readonly ilLanguage $lng)
 
 getValueForEvent (string $event)
 
 getValidEvents ()
 
 build ()
 
 getInputs ()
 

Private Attributes

array $events
 

Detailed Description

Definition at line 23 of file class.ilForumNotificationEventsFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumNotificationEventsFormGUI::__construct ( private readonly string  $action,
private ?array  $predefined_values,
private readonly \ILIAS\UI\Factory  $ui_factory,
private readonly ilLanguage  $lng 
)

Definition at line 34 of file class.ilForumNotificationEventsFormGUI.php.

39 {
40 }

Member Function Documentation

◆ build()

ilForumNotificationEventsFormGUI::build ( )

Definition at line 59 of file class.ilForumNotificationEventsFormGUI.php.

60 {
61 return $this->ui_factory->input()->container()->form()->standard(
62 $this->action,
63 $this->getInputs()
64 );
65 }
This describes commonalities between all forms.
Definition: Form.php:33

References getInputs().

+ Here is the call graph for this function:

◆ getInputs()

ilForumNotificationEventsFormGUI::getInputs ( )
Returns
array<string, FormInput>

Definition at line 70 of file class.ilForumNotificationEventsFormGUI.php.

70 : array
71 {
72 $items = [];
73
74 foreach (array_keys($this->events) as $key) {
75 $checkbox = $this->ui_factory->input()->field()->checkbox($this->lng->txt($key));
76 if ($this->predefined_values !== null && isset($this->predefined_values[$key])) {
77 $checkbox = $checkbox->withValue($this->predefined_values[$key]);
78 }
79
80 $items[$key] = $checkbox;
81 }
82
83 $hidden = $this->ui_factory->input()->field()->hidden();
84 if ($this->predefined_values !== null && isset($this->predefined_values['hidden_value'])) {
85 $hidden = $hidden->withValue((string) $this->predefined_values['hidden_value']);
86 }
87 $items['hidden_value'] = $hidden;
88
89 return $items;
90 }

References ILIAS\Repository\lng().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidEvents()

ilForumNotificationEventsFormGUI::getValidEvents ( )
Returns
list<string>

Definition at line 54 of file class.ilForumNotificationEventsFormGUI.php.

54 : array
55 {
56 return array_keys($this->events);
57 }

◆ getValueForEvent()

ilForumNotificationEventsFormGUI::getValueForEvent ( string  $event)

Definition at line 42 of file class.ilForumNotificationEventsFormGUI.php.

42 : int
43 {
44 if (isset($this->events[$event])) {
45 return $this->events[$event];
46 }
47
48 throw new InvalidArgumentException(sprintf('Event "%s" is not supported.', $event));
49 }

Field Documentation

◆ $events


The documentation for this class was generated from the following file: