Zend\Form\Form
Synopsis
class Form
extends Fieldset
implements
FormInterface
{
- // members
- protected array $attributes;
- protected int $bindAs;
- protected int $bindOnValidate;
- protected FieldsetInterface $baseFieldset;
- protected null|array|Traversable $data;
- protected null|InputFilterInterface $filter;
- protected bool $useInputFilterDefaults;
- protected bool $hasAddedInputFilterDefaults;
- protected bool $hasValidated;
- protected bool $isValid;
- protected bool $isPrepared;
- protected bool $preferFormInputFilter;
- protected bool $hasSetPreferFormInputFilter;
- protected bool $wrapElements;
- protected null|array $validationGroup;
- // Inherited members from Fieldset
- protected Factory $factory;
- protected array $byName;
- protected array $elements;
- protected array $fieldsets;
- protected array $messages;
- protected PriorityQueue $iterator;
- protected HydratorInterface $hydrator;
- protected null|object $object;
- protected bool $useAsBaseFieldset;
- protected string $allowedObjectBindingClass;
- // Inherited members from Element
- protected array $attributes;
- protected null|string $label;
- protected array $labelAttributes;
- protected array $labelOptions;
- protected array $messages;
- protected array $options;
- protected mixed $value;
- // methods
- public Element|ElementInterface setOptions()
- public FormInterface add()
- public Form prepare()
- public mixed|void prepareElement()
- public Form|FormInterface setData()
- public mixed|void bind()
- public FieldsetInterface setHydrator()
- public mixed bindValues()
- protected array prepareBindData()
- public void|Form setBindOnValidate()
- public bool bindOnValidate()
- public Form setBaseFieldset()
- public FieldsetInterface getBaseFieldset()
- public bool hasValidated()
- public bool isValid()
- public array|object getData()
- public Form|FormInterface setValidationGroup()
- public null|array getValidationGroup()
- protected void prepareValidationGroup()
- public FormInterface setInputFilter()
- public null|InputFilterInterface getInputFilter()
- public Form setUseInputFilterDefaults()
- public bool useInputFilterDefaults()
- public Form setPreferFormInputFilter()
- public bool getPreferFormInputFilter()
- public void attachInputFilterDefaults()
- public Form setWrapElements()
- public bool wrapElements()
- protected array extract()
- // Inherited methods from Fieldset
- public void __construct()
- public Element|ElementInterface setOptions()
- public Form setFormFactory()
- public Factory getFormFactory()
- public Fieldset|FieldsetInterface add()
- public bool has()
- public ElementInterface get()
- public FieldsetInterface remove()
- public FieldsetInterface setPriority()
- public array|Traversable getElements()
- public array|Traversable getFieldsets()
- public Element|ElementInterface|FieldsetInterface setMessages()
- public array|Traversable getMessages()
- public mixed|void prepareElement()
- public void populateValues()
- public int count()
- public PriorityQueue getIterator()
- public Fieldset|FieldsetInterface setObject()
- public mixed getObject()
- public void setAllowedObjectBindingClass()
- public string allowedObjectBindingClass()
- public bool allowObjectBinding()
- public FieldsetInterface setHydrator()
- public HydratorInterface getHydrator()
- public bool allowValueBinding()
- public mixed|void bindValues()
- public Fieldset setUseAsBaseFieldset()
- public bool useAsBaseFieldset()
- protected array extract()
- public void __clone()
- // Inherited methods from Element
- public void __construct()
- public void init()
- public Element|ElementInterface setName()
- public string|int getName()
- public Element|ElementInterface setOptions()
- public array getOptions()
- public NULL|mixed getOption()
- public self setOption()
- public Element|ElementInterface setAttribute()
- public mixed|null getAttribute()
- public ElementInterface removeAttribute()
- public bool hasAttribute()
- public Element|ElementInterface setAttributes()
- public array|Traversable getAttributes()
- public ElementInterface removeAttributes()
- public Element|ElementInterface clearAttributes()
- public Element setValue()
- public mixed getValue()
- public Element|ElementInterface setLabel()
- public null|string getLabel()
- public Element|ElementInterface setLabelAttributes()
- public array getLabelAttributes()
- public Element|ElementInterface setLabelOptions()
- public array getLabelOptions()
- public Element|ElementInterface clearLabelOptions()
- public ElementInterface removeLabelOptions()
- public Element|ElementInterface setLabelOption()
- public mixed|null getLabelOption()
- public ElementInterface removeLabelOption()
- public bool hasLabelOption()
- public Element|ElementInterface setMessages()
- public array|Traversable getMessages()
Hierarchy
Tasks
Line | Task |
---|---|
171 | find a better solution than duplicating the factory code, the problem being that if $elementOrFieldset is an array, |
152+ | Should we detect if the element/fieldset name conflicts? |
Constants
Name | Value |
---|---|
BIND_ON_VALIDATE | 0x00 |
BIND_MANUAL | 0x01 |
VALIDATE_ALL | 0x10 |
VALUES_NORMALIZED | 0x11 |
VALUES_RAW | 0x12 |
VALUES_AS_ARRAY | 0x13 |
Members
protected
- $allowedObjectBindingClass
—
string
The class or interface of objects that can be bound to this fieldset. - $attributes
—
array
Seed attributes - $attributes — array
- $baseFieldset
—
Zend\Form\FieldsetInterface
Base fieldset to use for hydrating (if none specified, directly hydrate elements) - $bindAs
—
int
How to bind values to the attached object - $bindOnValidate
—
int
Whether or not to bind values to the bound object on successful validation - $byName — array
- $data
—
Zend\Form\null|array|Traversable
Data being validated - $elements — array
- $factory — Zend\Form\Factory
- $fieldsets — array
- $filter — Zend\Form\null|InputFilterInterface
- $hasAddedInputFilterDefaults
—
Zend\Form\bool
Has the input filter defaults been added already ? - $hasSetPreferFormInputFilter
—
Zend\Form\bool
Has preferFormInputFilter been set with setPreferFormInputFilter? - $hasValidated
—
Zend\Form\bool
Whether or not validation has occurred - $hydrator
—
Zend\Form\Hydrator\HydratorInterface
Hydrator to use with bound object - $isPrepared
—
Zend\Form\bool
Is the form prepared ? - $isValid
—
Zend\Form\bool
Result of last validation operation - $iterator — Zend\Stdlib\PriorityQueue
- $label — Zend\Form\null|string
- $labelAttributes — array
- $labelOptions
—
array
Label specific options - $messages — array
- $messages — array
- $object
—
Zend\Form\null|object
The object bound to this fieldset, if any - $options — array
- $preferFormInputFilter
—
Zend\Form\bool
Prefer form input filter over input filter defaults - $useAsBaseFieldset
—
Zend\Form\bool
Should this fieldset be used as a base fieldset in the parent form ? - $useInputFilterDefaults
—
Zend\Form\bool
Whether or not to automatically scan for input filter defaults on attached fieldsets and elements - $validationGroup
—
Zend\Form\null|array
Validation group, if any - $value — mixed
- $wrapElements
—
Zend\Form\bool
Are the form elements/fieldsets wrapped by the form name ?
Methods
protected
- extract() — Recursively extract values for elements and sub-fieldsets, and populate form values
- prepareBindData() — Parse filtered values and return only posted fields for binding
- prepareValidationGroup() — Prepare the validation group in case Collection elements were used (this function also handle the case where elements could have been dynamically added or removed from a collection using JavaScript)
public
- add() — Add an element or fieldset
- attachInputFilterDefaults() — Attach defaults provided by the elements to the input filter
- bind() — Bind an object to the form
- bindOnValidate() — Will we bind values to the bound object on successful validation?
- bindValues() — Bind values to the bound object
- getBaseFieldset() — Get the base fieldset to use when hydrating
- getData() — Retrieve the validated data
- getInputFilter() — Retrieve input filter used by this form
- getPreferFormInputFilter() — Should we use form input filter over element input filter defaults from elements and fieldsets?
- getValidationGroup() — Retrieve the current validation group, if any
- hasValidated() — Check if the form has been validated
- isValid() — Validate the form
- prepare() — Ensures state is ready for use
- prepareElement() — Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid name clashes if the same fieldset is used multiple times
- setBaseFieldset() — Set the base fieldset to use when hydrating
- setBindOnValidate() — Set flag indicating whether or not to bind values on successful validation
- setData() — Set data to validate and/or populate elements
- setHydrator() — Set the hydrator to use when binding an object to the element
- setInputFilter() — Set the input filter used by this form
- setOptions() — Set options for a form. Accepted options are: - prefer_form_input_filter: is form input filter is preferred?
- setPreferFormInputFilter() — Set flag indicating whether or not to prefer the form input filter over element and fieldset defaults
- setUseInputFilterDefaults() — Set flag indicating whether or not to scan elements and fieldsets for defaults
- setValidationGroup() — Set the validation group (set of values to validate)
- setWrapElements() — Are the form elements/fieldsets names wrapped by the form name ?
- useInputFilterDefaults() — Should we use input filter defaults from elements and fieldsets?
- wrapElements() — If true, form elements/fieldsets name's are wrapped around the form name itself
Inherited from Zend\Form\Fieldset
protected
- extract() — Extract values from the bound object
public
- __clone() — Make a deep clone of a fieldset
- add() — Add an element or fieldset
- allowObjectBinding() — Checks if the object can be set in this fieldset
- allowValueBinding() — Checks if this fieldset can bind data
- allowedObjectBindingClass() — Get The class or interface of objects that can be bound to this fieldset.
- bindValues() — Bind values to the bound object
- count() — Countable: return count of attached elements/fieldsets
- get() — Retrieve a named element or fieldset
- getElements() — Retrieve all attached elements
- getFieldsets() — Retrieve all attached fieldsets
- getFormFactory() — Retrieve composed form factory
- getHydrator() — Get the hydrator used when binding an object to the fieldset
- getIterator() — IteratorAggregate: return internal iterator
- getMessages() — Get validation error messages, if any
- getObject() — Get the object used by the hydrator
- has() — Does the fieldset have an element/fieldset by the given name?
- populateValues() — Recursively populate values of attached elements and fieldsets
- prepareElement() — Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid name clashes if the same fieldset is used multiple times
- remove() — Remove a named element or fieldset
- setAllowedObjectBindingClass() — Set the class or interface of objects that can be bound to this fieldset.
- setFormFactory() — Compose a form factory to use when calling add() with a non-element/fieldset
- setHydrator() — Set the hydrator to use when binding an object to the element
- setMessages() — Set a hash of element names/messages to use when validation fails
- setObject() — Set the object used by the hydrator
- setOptions() — Set options for a fieldset. Accepted options are: - use_as_base_fieldset: is this fieldset use as the base fieldset?
- setPriority() — Set/change the priority of an element or fieldset
- setUseAsBaseFieldset() — Set if this fieldset is used as a base fieldset
- useAsBaseFieldset() — Is this fieldset use as a base fieldset for a form ?
Inherited from Zend\Form\Element
public
- clearAttributes() — Clear all attributes
- clearLabelOptions() — Clear all label options
- getAttribute() — Retrieve a single element attribute
- getAttributes() — Retrieve all attributes at once
- getLabel() — Retrieve the label used for this element
- getLabelAttributes() — Get the attributes to use with the label
- getLabelOption() — Retrieve a single label option
- getLabelOptions() — Get label specific options
- getMessages() — Get validation error messages, if any.
- getName() — Get value for name
- getOption() — Return the specified option
- getOptions() — Get defined options
- getValue() — Retrieve the element value
- hasAttribute() — Does the element has a specific attribute ?
- hasLabelOption() — Does the element has a specific label option ?
- init() — This function is automatically called when creating element with factory. It allows to perform various operations (add elements...)
- removeAttribute() — Remove a single attribute
- removeAttributes() — Remove many attributes at once
- removeLabelOption() — Remove a single label option
- removeLabelOptions() — Remove many attributes at once
- setAttribute() — Set a single element attribute
- setAttributes() — Set many attributes at once
- setLabel() — Set the label used for this element
- setLabelAttributes() — Set the attributes to use with the label
- setLabelOption() — Set a single label optionn
- setLabelOptions() — Set many label options at once
- setMessages() — Set a list of messages to report when validation fails
- setName() — Set value for name
- setOption() — Set a single option for an element
- setOptions() — Set options for an element. Accepted options are: - label: label to associate with the element - label_attributes: attributes to use when the label is rendered - label_options: label specific options
- setValue() — Set the element value