container element base class More...
The abstract container class contains the base for container type elements. ie. htmlform, fieldset and step
The container class implements various magic methods to add new input elements
Element addAddress($name, $parameters = array()) Adds a new address fieldset to the container.
Element addBoolean($name, $parameters = array()) Adds a new boolean input element to the container.
Element addButton($name, $parameters = array()) Adds a new button input element to the container.
Element addCaptcha($name, $parameters = array()) Adds a new captcha input element to the container.
Element addColor($name, $parameters = array()) Adds a new color input element to the container.
Element addCreditcard($name, $parameters = array()) Adds a new creditcard fieldset to the container.
Element addDate($name, $parameters = array()) Adds a new date input element to the container.
Element addDatetime($name, $parameters = array()) Adds a new datetime input element to the container.
Element addEmail($name, $parameters = array()) Adds a new email input element to the container.
Element addFieldset($name, $parameters = array()) Adds a new fieldset container to the container.
Element addFile($name, $parameters = array()) Adds a new file input element to the container.
Element addHidden($name, $parameters = array()) Adds a new hidden input element to the container.
Element addMonth($name, $parameters = array()) Adds a new month input element to the container.
Element addMultiple($name, $parameters = array()) Adds a new multiple
Element addNumber($name, $parameters = array()) Adds a new number input element to the container.
Element addPassword($name, $parameters = array()) Adds a new password
Element addPlaceholder($name, $parameters = array()) Adds a new placeholder input element to the container.
Element addPlaceholderMultiple($name, $parameters = array()) Adds a new multiple placeholder input element to the container
Element addRange($name, $parameters = array()) Adds a new range input element to the container.
Element addRichtext($name, $parameters = array()) Adds a new richtext input element to the container.
Element addSearch($name, $parameters = array()) Adds a new search input element to the container.
Element addSingle($name, $parameters = array()) Adds a new single choice input element to the container.
Element addState($name, $parameters = array()) Adds a new state input element to the container.
Element addStep($name, $parameters = array()) Adds a new step container
Element addTel($name, $parameters = array()) Adds a new telephone input element to the container.
Element addText($name, $parameters = array()) Adds a new text input element to the container.
Element addTextarea($name, $parameters = array()) Adds a new textarea input
Element addTime($name, $parameters = array()) Adds a new time input element to the container.
Element addUrl($name, $parameters = array()) Adds a new URL input element to the container.
Element addWeek($name, $parameters = array()) Adds a new week input element to the container.
Definition at line 59 of file Container.php.
Public Member Functions | |
| __construct (string $name, array $parameters, object $form) | |
| container class constructor | |
| __call (string $function, array $arguments) | |
| HTML escaping and add subelements. | |
| addChildElements () | |
| Sub-element generator hook. | |
| getElements (bool $includeFieldsets=false) | |
| Returns containers subelements. | |
| getElement (string $name, bool $includeFieldsets=false) | |
| Gets subelement by name. | |
| addHtml (string $html) | |
| Adds a new custom HTML element to the container. | |
| addStepNav (array $parameter=[]) | |
| Adds automatic step navigation to output. | |
| setRequired (bool $required=true) | |
| Sets required-attribute. | |
| validate () | |
| Validates container and its contents. | |
| clearValue () | |
| Deletes values of all child elements. | |
| Public Member Functions inherited from Element | |
| __construct (string $name, array $parameters, object|null $form) | |
| element class constructor | |
| setDisabled (bool $disabled=true) | |
| Sets the HTML disabled-attribute of the current input element. | |
| getDisabled () | |
| Gets if input is currently disabled. | |
| getName () | |
| Returns the element name. | |
Protected Member Functions | |
| addElement (string $type, string $name, array $parameters) | |
| Generates sub-elements. | |
| Protected Member Functions inherited from Element | |
| setDefaults () | |
| Collects initial values across subclasses. | |
| log (string $argument, string $type=null) | |
| error & warning logger | |
| htmlEscape (array|string $options=[]) | |
| Escapes HTML in strings and arrays of strings. | |
| htmlDataAttributes () | |
| Returns dataAttr escaped as attribute string. | |
Protected Attributes | |
| $elements = [] | |
| References to input elements and fieldsets. | |
| $elementsAndHtml = [] | |
| Input element, fieldset and custom HTML object references. | |
| $form | |
| Parent form object reference. | |
| Protected Attributes inherited from Element | |
| $name | |
| Element name. | |
| $validated = false | |
| True if the element has been validated before. | |
| $log | |
| Log object reference. | |
| $defaults = [] | |
| holds default values for element attributes | |
| $disabled = false | |
| wether a input element will be disabled | |
| $class | |
| CSS class of the container element. | |
Additional Inherited Members | |
| Data Fields inherited from Element | |
| $valid | |
| Contains element validation status/result. | |
| $dataAttr | |
| Extra information about the data that is saved inside the element. | |
| __construct | ( | string | $name, |
| array | $parameters, | ||
| object | $form ) |
| string | $name | container name |
| array | $parameters | container parameters, HTML attributes |
| object | $form | parent form object |
Reimplemented in Address.
Definition at line 81 of file Container.php.
| __call | ( | string | $function, |
| array | $arguments ) |
| string | $function | function name |
| array | $arguments | function arguments |
Reimplemented from Element.
Definition at line 104 of file Container.php.
| addChildElements | ( | ) |
Adds child elements just after container construction. Can be used for subclasses of the container class to add new elements to itself.
(see Depage::HtmlForm::Elements::Creditcard for an example implementation)
Reimplemented in Address, and Creditcard.
Definition at line 165 of file Container.php.
|
protected |
Adds new child elements to $this->elements.
| string | $type | elememt type |
| string | $name | element name |
| array | $parameters | element attributes: HTML attributes, validation parameters etc. |
Reimplemented in Fieldset, and HtmlForm.
Definition at line 137 of file Container.php.
| addHtml | ( | string | $html | ) |
| string | $html | HTML code |
Definition at line 219 of file Container.php.
| addStepNav | ( | array | $parameter = [] | ) |
| array | $parameter | array of opional parameters |
Definition at line 232 of file Container.php.
| clearValue | ( | ) |
| getElement | ( | string | $name, |
| bool | $includeFieldsets = false ) |
Searches subelements by name and returns a single element object if successful. Returns false if the element can't be found.
| string | $name | name of the input element we're looking for |
Definition at line 200 of file Container.php.
| getElements | ( | bool | $includeFieldsets = false | ) |
Walks recursively through current containers' elements to compile a list of subelements.
| bool | $includeFieldsets | include fieldset/step elements in result |
Definition at line 175 of file Container.php.
| setRequired | ( | bool | $required = true | ) |
Sets current containers' elements' HTML-required attribute recursively.
| bool | $required | HTML-required attribute |
Definition at line 249 of file Container.php.
| validate | ( | ) |
Walks recursively through current containers' elements and checks if they're valid. Saves the result to $this->valid.
Reimplemented in Address, Creditcard, and HtmlForm.
Definition at line 265 of file Container.php.
|
protected |
Definition at line 64 of file Container.php.
|
protected |
Definition at line 68 of file Container.php.
|
protected |
Definition at line 72 of file Container.php.