interface FormInterface implements ArrayAccess, Traversable, Countable
A form group bundling multiple forms in a hierarchical structure.
Methods
| FormInterface |
setParent(FormInterface $parent = null)
Sets the parent form. |
|
| FormInterface|null |
getParent()
Returns the parent form. |
|
| FormInterface |
add(FormInterface|string|integer $child, string|null $type = null, array $options = array())
Adds a child to the form. |
|
| FormInterface |
get(string $name)
Returns the child with the given name. |
|
| Boolean |
has(string $name)
Returns whether a child with the given name exists. |
|
| FormInterface |
remove(string $name)
Removes a child from the form. |
|
| FormInterface[] |
all()
Returns all children in this group. |
|
| FormError[] |
getErrors()
Returns all errors. |
|
| FormInterface |
setData(mixed $modelData)
Updates the form with default data. |
|
| mixed |
getData()
Returns the data in the format needed for the underlying object. |
|
| mixed |
getNormData()
Returns the normalized data of the field. |
|
| mixed |
getViewData()
Returns the data transformed by the value transformer. |
|
| array |
getExtraData()
Returns the extra data. |
|
| FormConfigInterface |
getConfig()
Returns the form's configuration. |
|
| Boolean |
isSubmitted()
Returns whether the form is submitted. |
|
| string |
getName()
Returns the name by which the form is identified in forms. |
|
| PropertyPathInterface |
getPropertyPath()
Returns the property path that the form is mapped to. |
|
| FormInterface |
addError(FormError $error)
Adds an error to this form. |
|
| Boolean |
isValid()
Returns whether the form and all children are valid. |
|
| Boolean |
isRequired()
Returns whether the form is required to be filled out. |
|
| Boolean |
isDisabled()
Returns whether this form is disabled. |
|
| Boolean |
isEmpty()
Returns whether the form is empty. |
|
| Boolean |
isSynchronized()
Returns whether the data in the different formats is synchronized. |
|
| FormInterface |
initialize()
Initializes the form tree. |
|
| FormInterface |
handleRequest(mixed $request = null)
Inspects the given request and calls {@link submit()} if the form was submitted. |
|
| FormInterface |
submit(null|string|array $submittedData, Boolean $clearMissing = true)
Submits data to the form, transforms and validates it. |
|
| FormInterface |
getRoot()
Returns the root of the form tree. |
|
| Boolean |
isRoot()
Returns whether the field is the root of the form tree. |
|
| FormView |
createView(FormView $parent = null)
Creates a view. |
Details
at line 32
public FormInterface
setParent(FormInterface $parent = null)
Sets the parent form.
at line 39
public FormInterface|null
getParent()
Returns the parent form.
at line 54
public FormInterface
add(FormInterface|string|integer $child, string|null $type = null, array $options = array())
Adds a child to the form.
at line 65
public FormInterface
get(string $name)
Returns the child with the given name.
at line 74
public Boolean
has(string $name)
Returns whether a child with the given name exists.
at line 85
public FormInterface
remove(string $name)
Removes a child from the form.
at line 92
public FormInterface[]
all()
Returns all children in this group.
at line 99
public FormError[]
getErrors()
Returns all errors.
at line 113
public FormInterface
setData(mixed $modelData)
Updates the form with default data.
at line 120
public mixed
getData()
Returns the data in the format needed for the underlying object.
at line 129
public mixed
getNormData()
Returns the normalized data of the field.
at line 136
public mixed
getViewData()
Returns the data transformed by the value transformer.
at line 143
public array
getExtraData()
Returns the extra data.
at line 150
public FormConfigInterface
getConfig()
Returns the form's configuration.
at line 157
public Boolean
isSubmitted()
Returns whether the form is submitted.
at line 164
public string
getName()
Returns the name by which the form is identified in forms.
at line 171
public PropertyPathInterface
getPropertyPath()
Returns the property path that the form is mapped to.
at line 180
public FormInterface
addError(FormError $error)
Adds an error to this form.
at line 189
public Boolean
isValid()
Returns whether the form and all children are valid.
If the form is not submitted, this method always returns false.
at line 200
public Boolean
isRequired()
Returns whether the form is required to be filled out.
If the form has a parent and the parent is not required, this method
will always return false. Otherwise the value set with setRequired()
is returned.
at line 213
public Boolean
isDisabled()
Returns whether this form is disabled.
The content of a disabled form is displayed, but not allowed to be
modified. The validation of modified disabled forms should fail.
Forms whose parents are disabled are considered disabled regardless of
their own state.
at line 220
public Boolean
isEmpty()
Returns whether the form is empty.
at line 227
public Boolean
isSynchronized()
Returns whether the data in the different formats is synchronized.
at line 236
public FormInterface
initialize()
Initializes the form tree.
Should be called on the root form after constructing the tree.
at line 250
public FormInterface
handleRequest(mixed $request = null)
Inspects the given request and calls {@link submit()} if the form was submitted.
Internally, the request is forwarded to the configured
{@link RequestHandlerInterface} instance, which determines whether to
submit the form or not.
at line 264
public FormInterface
submit(null|string|array $submittedData, Boolean $clearMissing = true)
Submits data to the form, transforms and validates it.
at line 271
public FormInterface
getRoot()
Returns the root of the form tree.
at line 278
public Boolean
isRoot()
Returns whether the field is the root of the form tree.
at line 287
public FormView
createView(FormView $parent = null)
Creates a view.