30 return get_called_class();
48 static $collectedFormElements;
49 if (!$collectedFormElements)
67 private function addToConfiguration(
BaseValuable $element)
74 $newConfiguration->setGId(Util::generateUserUniqueId());
75 $newConfiguration->setFieldClassName($element::getClassName());
76 $newConfiguration->setKey($element->
getKey());
77 $newConfiguration->setValue($element->
getValue());
78 $newConfiguration->setWeight($element->
getWeight());
79 $this->configurations[] = $newConfiguration;
91 if ($element->getKey())
93 $this->formElementsList[$element->getKey()] = $element;
97 $this->formElementsList[] = $element;
102 $this->addToConfiguration($element);
116 $newFormElementsList = array();
117 foreach ($this->formElementsList as $key => $element)
121 if ($element === $targetElement)
123 if ($newElement->getKey())
125 $newFormElementsList[$newElement->getKey()] = $newElement;
129 $newFormElementsList[] = $newElement;
134 $this->addToConfiguration($newElement);
141 $newFormElementsList[$key] = $element;
145 $newFormElementsList[] = $element;
148 $this->formElementsList = $newFormElementsList;
160 $newFormElementsList = [];
161 foreach ($this->formElementsList as $key => $element)
166 $newFormElementsList[$key] = $element;
170 $newFormElementsList[] = $element;
174 if ($element === $targetElement)
176 if ($newElement->getKey())
178 $newFormElementsList[$newElement->getKey()] = $newElement;
182 $newFormElementsList[] = $newElement;
187 $this->addToConfiguration($newElement);
192 $this->formElementsList = $newFormElementsList;
203 $firstFormElement = reset($this->formElementsList);
204 if ($firstFormElement)
229 $this->formElementsList = [];
230 $this->configurations = [];
231 foreach ($formElementList as $element)
244 if (is_string($formElement))
249 if (!$formElement || !($formElement instanceof
BaseValuable))
254 $formElement->setValue($value);
258 $configuration->setValue($formElement->getValue());
262 $this->addToConfiguration($formElement);
272 return $this->formElementsList;
284 if (isset($formElements[$fieldKey]))
286 return $formElements[$fieldKey];
303 if (isset($formElements[$fieldKey]))
305 return $formElements[$fieldKey]->getValue();
321 if ($reportHandlerFormElements)
323 foreach ($reportHandlerFormElements as $element)
325 if ($element->getDataAttribute($attributeKey) === $value)
344 if (!empty($this->formElementsList[$element->getKey()]))
347 foreach ($this->configurations as $i => $configurationFromList)
349 if ($configurationFromList === $configuration)
351 unset($this->configurations[$i]);
357 foreach ($this->formElementsList as $i => $elementFromList)
359 if ($element === $elementFromList)
361 unset($this->formElementsList[$i]);
382 return $this->configurations;
392 foreach ($reports as $configuration)
394 $result[$configuration->getGId()] = $configuration;
412 if ($configuration->getKey() == $key)
413 return $configuration;
432 if ($configuration && $configuration->getId())
434 $id =
'[old][' . $configuration->getGId() .
']';
437 $name .=
'[configurations]' . $id .
'[' . $element->
getKey() .
']';
getFormElement($fieldKey)
updateFormElementValue($formElement, $value)
addFormElementAfter(BaseFormElement $newElement, BaseFormElement $targetElement)
getFormElementByDataAttribute($attributeKey, $value)
addFormElementToStart(BaseFormElement $newElement)
getConfigurationsGidKeyed()
removeFormElement(BaseFormElement $element)
getNameForFormElement(BaseValuable $element)
getCollectedFormElements()
getFormElementValue($fieldKey)
setConfigurations($configurations)
getFormElementFromCollected($key)
addFormElementToEnd(BaseFormElement $newElement)
addFormElement(BaseFormElement $element)
addFormElementBefore(BaseFormElement $newElement, BaseFormElement $targetElement)
setFormElements($formElementList)