Form
in package
This is the Form class.
This class represents an entire 'form' of the commerce, with its attributes, events, inputs, template,...
Tags
Table of Contents
ELEMENT_FORM_END | = 'formEnd' | |
---|---|---|
ELEMENT_FORM_START | = 'formStart' | |
SUBMIT | = 'submit' | |
$formHead | This is the head of the form. | : Form |
$inputs | Inputs of the form. | : array<string|int, mixed> |
$template | Template of the form. | : string |
$validatorPid | ValidatorPid of the form. | : string |
__construct() | Constructor. It creates a Form with the given FormHead and inputs. | : mixed |
getArrayDefinitionElement() | : array<string|int, mixed> | |
getArrayInputFilterParameters() | This method returns an array with all the inputs of the given inputs array and their filters, where the key of each node is the name of the input and the value of the node is the corresponding FilterInput. | : array<string|int, mixed> |
getArrayInputFilterParametersInOneLevel() | This method returns an array with all the inputs of the given inputs array and their filters, where the key of each node is the parentKey concatenated with the name of the input, and the value of the node is the corresponding FilterInput. | : array<string|int, mixed> |
getArrayOutputElement() | This method returns an array with all the outputs of the form inputs, where the key of each node is the name of the input and the value of the node is the corresponding output of the input. | : array<string|int, mixed> |
getDefinitionElements() | This method returns an array with the definition of all the elements of the form: <ul> <li>self::ELEMENT_FORM_START -> This key position contains an array with the form header outputs (attributes and events of the form).</li> <li>self::ELEMENT_FORM_END -> This key position contains the output of the end of the form (null).</li> <li>The rest of positions are the outputs of each of the form inputs.</li> </ul> | : array<string|int, mixed> |
getInputFilterParameters() | This method returns an array with all the inputs of the form and their filters, where the key of each node is the name of the input and the value of the node is the corresponding FilterInput. | : array<string|int, mixed> |
getInputFilterParametersInOneLevel() | This method returns an array with all the inputs of the form and their filters, where the key of each node is the parentKey concatenated with the name of the input, and the value of the node is the corresponding FilterInput. | : array<string|int, mixed> |
getInputItems() | This method returns an array with all the inputs items, | : array<string|int, mixed> |
getOutputElements() | This method returns an array with the output of all the elements of the form: <ul> <li>self::ELEMENT_FORM_START -> This key position contains an array with the form header outputs (attributes and events of the form).</li> <li>self::ELEMENT_FORM_END -> This key position contains the output of the end of the form ('</form>').</li> <li>The rest of positions are the outputs of each of the form inputs.</li> </ul> | : array<string|int, mixed> |
getTemplate() | This method returns the Form's template. | : string |
removeInputElement() | This method remove the element by the given name | : void |
setTemplate() | This method sets the template of the Form. | : Form |
setValidatorPId() | This method sets the validator PId of the form. | : Form |
Constants
ELEMENT_FORM_END
public
mixed
ELEMENT_FORM_END
= 'formEnd'
ELEMENT_FORM_START
public
mixed
ELEMENT_FORM_START
= 'formStart'
SUBMIT
public
mixed
SUBMIT
= 'submit'
Properties
$formHead
This is the head of the form.
protected
Form
$formHead
Tags
$inputs
Inputs of the form.
protected
array<string|int, mixed>
$inputs
= []
$template
Template of the form.
protected
string
$template
= ''
$validatorPid
ValidatorPid of the form.
protected
string
$validatorPid
= ''
Methods
__construct()
Constructor. It creates a Form with the given FormHead and inputs.
public
__construct(Form $formHead, array<string|int, mixed> $inputs) : mixed
Parameters
- $formHead : Form
- $inputs : array<string|int, mixed>
Return values
mixed —getArrayDefinitionElement()
public
getArrayDefinitionElement(array<string|int, mixed> $inputs) : array<string|int, mixed>
Parameters
- $inputs : array<string|int, mixed>
Return values
array<string|int, mixed> —getArrayInputFilterParameters()
This method returns an array with all the inputs of the given inputs array and their filters, where the key of each node is the name of the input and the value of the node is the corresponding FilterInput.
public
getArrayInputFilterParameters(array<string|int, mixed> $inputs) : array<string|int, mixed>
Parameters
- $inputs : array<string|int, mixed>
Return values
array<string|int, mixed> —getArrayInputFilterParametersInOneLevel()
This method returns an array with all the inputs of the given inputs array and their filters, where the key of each node is the parentKey concatenated with the name of the input, and the value of the node is the corresponding FilterInput.
public
getArrayInputFilterParametersInOneLevel(string $parentKey, array<string|int, mixed> $inputs) : array<string|int, mixed>
Only one level array is returned, so there is no nodes containing an array as a value.
Parameters
- $parentKey : string
- $inputs : array<string|int, mixed>
Return values
array<string|int, mixed> —getArrayOutputElement()
This method returns an array with all the outputs of the form inputs, where the key of each node is the name of the input and the value of the node is the corresponding output of the input.
public
getArrayOutputElement(array<string|int, mixed> $inputs[, array<string|int, mixed> $richFormList = [] ]) : array<string|int, mixed>
Parameters
- $inputs : array<string|int, mixed>
- $richFormList : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getDefinitionElements()
This method returns an array with the definition of all the elements of the form: <ul> <li>self::ELEMENT_FORM_START -> This key position contains an array with the form header outputs (attributes and events of the form).</li> <li>self::ELEMENT_FORM_END -> This key position contains the output of the end of the form (null).</li> <li>The rest of positions are the outputs of each of the form inputs.</li> </ul>
public
getDefinitionElements() : array<string|int, mixed>
Return values
array<string|int, mixed> —getInputFilterParameters()
This method returns an array with all the inputs of the form and their filters, where the key of each node is the name of the input and the value of the node is the corresponding FilterInput.
public
getInputFilterParameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —getInputFilterParametersInOneLevel()
This method returns an array with all the inputs of the form and their filters, where the key of each node is the parentKey concatenated with the name of the input, and the value of the node is the corresponding FilterInput.
public
getInputFilterParametersInOneLevel() : array<string|int, mixed>
Only one level array is returned, so there is no nodes containing an array as a value.
Return values
array<string|int, mixed> —getInputItems()
This method returns an array with all the inputs items,
public
getInputItems() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOutputElements()
This method returns an array with the output of all the elements of the form: <ul> <li>self::ELEMENT_FORM_START -> This key position contains an array with the form header outputs (attributes and events of the form).</li> <li>self::ELEMENT_FORM_END -> This key position contains the output of the end of the form ('</form>').</li> <li>The rest of positions are the outputs of each of the form inputs.</li> </ul>
public
getOutputElements([array<string|int, mixed> $richFormList = [] ]) : array<string|int, mixed>
Parameters
- $richFormList : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getTemplate()
This method returns the Form's template.
public
getTemplate() : string
Return values
string —removeInputElement()
This method remove the element by the given name
public
removeInputElement(string $name) : void
Parameters
- $name : string
Return values
void —setTemplate()
This method sets the template of the Form.
public
setTemplate(string $template) : Form
Parameters
- $template : string
Return values
Form —setValidatorPId()
This method sets the validator PId of the form.
public
setValidatorPId(string $validatorPId) : Form
Parameters
- $validatorPId : string