19 declare(strict_types=1);
32 if (count($this->elements)) {
36 $this->elements = array();
42 $this->elements[$name] = $factory->getFormBridgeForInstance($element);
43 $this->elements[$name]->setForm($this->
getForm());
44 $this->elements[$name]->setElementId((
string) $name);
57 if (array_key_exists($a_name, $this->elements)) {
58 return $this->elements[$a_name];
67 $section->setTitle($this->
getTitle());
70 $section->setInfo($this->
getInfo());
73 $this->
getForm()->addItem($section);
77 foreach ($this->elements as $element) {
78 $element->addToForm();
85 foreach ($this->elements as $element) {
86 $element->addJS($a_tpl);
93 foreach ($this->elements as $element) {
95 $parent = $element->getParentElement();
102 if ($element->shouldBeImportedFromPost(
$parent)) {
103 $element->importFromPost();
113 foreach ($this->
getElements() as $element_id => $element) {
114 if ($element->isRequired() && $element->getADT()->isNull()) {
115 $field = $this->
getForm()->getItemByPostVar($element_id);
116 $field->setAlert($this->
lng->txt(
"msg_input_is_required"));
119 elseif (!$element->validate()) {
124 if (!$this->
getADT()->isValid()) {
129 $mess = $this->
getADT()->getValidationErrorsByElements();
130 foreach ($mess as $error_code => $element_id) {
131 $tmp[$element_id][] = $this->
getADT()->translateErrorCode($error_code);
134 foreach ($tmp as $element_id => $errors) {
135 $field = $this->
getForm()->getItemByPostVar((
string) $element_id);
136 $field->setAlert(implode(
"<br />", $errors));
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null