47 parent::__construct(
$name, $parameters,
$form);
66 public function __call($function, $arguments)
68 if (substr($function, 0, 3) ===
'add') {
69 $type = str_replace(
'add',
'', $function);
71 foreach($this->form->getNamespaces() as $namespace) {
72 $class = $namespace .
'\\' . $type;
73 if (class_exists(
$class)) {
74 $name = isset($arguments[0]) ? $arguments[0] :
'';
75 $parameters = isset($arguments[1]) ? $arguments[1] : array();
82 return parent::__call($function, $arguments);
105 $newElement =
new $type(
$name, $parameters, $this->form);
107 $this->elements[] = $newElement;
108 $this->elementsAndHtml[] = $newElement;
110 if ($newElement instanceof container) {
111 $newElement->addChildElements();
141 $allElements = array();
142 foreach ($this->elements as $element) {
144 if ($includeFieldsets) {
145 $allElements[] = $element;
147 $allElements = array_merge($allElements, $element->getElements($includeFieldsets));
149 $allElements[] = $element;
166 foreach ($this->
getElements($includeFieldsets) as $element) {
167 if (
$name === $element->getName()) {
187 $this->elementsAndHtml[] = $htmlElement;
200 $this->elementsAndHtml[] = $htmlElement;
215 $required = (bool) $required;
217 foreach ($this->elements as $element) {
218 $element->setRequired($required);
231 if (!$this->validated) {
232 $this->validated =
true;
235 foreach ($this->elements as $element) {
236 $valid = $element->validate();
237 $this->valid = $this->valid &&
$valid;
251 $element->clearValue();
container element base class
getElements($includeFieldsets=false)
Returns containers subelements.
addElement($type, $name, $parameters)
Generates sub-elements.
addChildElements()
Sub-element generator hook.
setRequired($required=true)
Sets required-attribute.
validate()
Validates container and its contents.
$form
Parent form object reference.
__construct($name, $parameters, $form)
container class constructor
clearValue()
Deletes values of all child elements.
addStepNav($parameter=array())
Adds automatic step navigation to output.
addHtml($html)
Adds a new custom HTML element to the container.
__call($function, $arguments)
HTML escaping and add subelements.
getElement($name, $includeFieldsets=false)
Gets subelement by name.
$elementsAndHtml
Input element, fieldset and custom HTML object references.
$elements
References to input elements and fieldsets.
$valid
Contains element validation status/result.
$class
CSS class of the container element.
$log
Log object reference.
checkParameters($parameters)
checks element parameters
Can be used to insert custom HTML between rendered HTML elements.
Can be used to insert a step navigation.
thrown when attemting to instantiate an inexistent element class
Abstract element classes.
Classes for HTML input-elements.