class SubmitButton extends Button implements ClickableInterface

A button that submits the form.

Methods

__construct(FormConfigInterface $config)

Creates a new button from a form configuration.

from Button
bool
offsetExists(mixed $offset)

Unsupported method.

from Button
offsetGet(mixed $offset)

Unsupported method.

from Button
offsetSet(mixed $offset, mixed $value)

Unsupported method.

from Button
offsetUnset(mixed $offset)

Unsupported method.

from Button
setParent(FormInterface $parent = null)

Sets the parent form.

from Button
getParent()

Returns the parent form.

from Button
add(FormInterface|string|int $child, string|null $type = null, array $options = array())

Adds or replaces a child to the form.

from Button
get(string $name)

Returns the child with the given name.

from Button
bool
has(string $name)

Returns whether a child with the given name exists.

from Button
$this
remove(string $name)

Removes a child from the form.

from Button
all()

Returns all children in this group.

from Button
getErrors(bool $deep = false, bool $flatten = true)

Returns the errors of this form.

from Button
$this
setData(mixed $modelData)

Updates the form with default data.

from Button
mixed
getData()

Returns the data in the format needed for the underlying object.

from Button
mixed
getNormData()

Returns the normalized data of the field.

from Button
mixed
getViewData()

Returns the data transformed by the value transformer.

from Button
array
getExtraData()

Returns the extra data.

from Button
getConfig()

Returns the form's configuration.

from Button
bool
isSubmitted()

Returns whether the form is submitted.

from Button
string
getName()

Returns the name by which the form is identified in forms.

from Button
getPropertyPath()

Returns the property path that the form is mapped to.

from Button
$this
addError(FormError $error)

Adds an error to this form.

from Button
bool
isValid()

Returns whether the form and all children are valid.

from Button
bool
isRequired()

Returns whether the form is required to be filled out.

from Button
bool
isDisabled()

Returns whether this form is disabled.

from Button
bool
isEmpty()

Returns whether the form is empty.

from Button
bool
isSynchronized()

Returns whether the data in the different formats is synchronized.

from Button
getTransformationFailure()

Returns the data transformation failure, if any.

from Button
$this
initialize()

Initializes the form tree.

from Button
$this
handleRequest(mixed $request = null)

Inspects the given request and calls {@link submit()} if the form was submitted.

from Button
$this
submit(mixed $submittedData, bool $clearMissing = true)

Submits data to the button.

getRoot()

Returns the root of the form tree.

from Button
bool
isRoot()

Returns whether the field is the root of the form tree.

from Button
createView(FormView $parent = null)

Creates a view.

from Button
int
count()

Unsupported method.

from Button
getIterator()

Unsupported method.

from Button
bool
isClicked()

Returns whether this element was clicked.

Details

__construct(FormConfigInterface $config)

Creates a new button from a form configuration.

Parameters

FormConfigInterface $config The button's configuration

bool offsetExists(mixed $offset)

Unsupported method.

Parameters

mixed $offset

Return Value

bool Always returns false

offsetGet(mixed $offset)

Unsupported method.

This method should not be invoked.

Parameters

mixed $offset

Exceptions

BadMethodCallException

offsetSet(mixed $offset, mixed $value)

Unsupported method.

This method should not be invoked.

Parameters

mixed $offset
mixed $value

Exceptions

BadMethodCallException

offsetUnset(mixed $offset)

Unsupported method.

This method should not be invoked.

Parameters

mixed $offset

Exceptions

BadMethodCallException

FormInterface setParent(FormInterface $parent = null)

Sets the parent form.

Parameters

FormInterface $parent

Return Value

FormInterface

Exceptions

AlreadySubmittedException if the form has already been submitted
LogicException when trying to set a parent for a form with an empty name

FormInterface|null getParent()

Returns the parent form.

Return Value

FormInterface|null The parent form or null if there is none

FormInterface add(FormInterface|string|int $child, string|null $type = null, array $options = array())

Adds or replaces a child to the form.

Parameters

FormInterface|string|int $child The FormInterface instance or the name of the child
string|null $type The child's type, if a name was passed
array $options The child's options, if a name was passed

Return Value

FormInterface

Exceptions

AlreadySubmittedException if the form has already been submitted
LogicException when trying to add a child to a non-compound form
UnexpectedTypeException if $child or $type has an unexpected type

FormInterface get(string $name)

Returns the child with the given name.

Parameters

string $name The name of the child

Return Value

FormInterface

Exceptions

OutOfBoundsException if the named child does not exist

bool has(string $name)

Returns whether a child with the given name exists.

Parameters

string $name The name of the child

Return Value

bool

$this remove(string $name)

Removes a child from the form.

Parameters

string $name The name of the child to remove

Return Value

$this

Exceptions

AlreadySubmittedException if the form has already been submitted

FormInterface[] all()

Returns all children in this group.

Return Value

FormInterface[]

FormErrorIterator getErrors(bool $deep = false, bool $flatten = true)

Returns the errors of this form.

Parameters

bool $deep Whether to include errors of child forms as well
bool $flatten Whether to flatten the list of errors in case $deep is set to true

Return Value

FormErrorIterator An iterator over the {@link FormError} instances that where added to this form

$this setData(mixed $modelData)

Updates the form with default data.

Parameters

mixed $modelData The data formatted as expected for the underlying object

Return Value

$this

Exceptions

AlreadySubmittedException if the form has already been submitted
LogicException If listeners try to call setData in a cycle. Or if the view data does not match the expected type according to {@link FormConfigInterface::getDataClass}.

mixed getData()

Returns the data in the format needed for the underlying object.

Return Value

mixed

mixed getNormData()

Returns the normalized data of the field.

Return Value

mixed When the field is not submitted, the default data is returned. When the field is submitted, the normalized submitted data is returned if the field is valid, null otherwise.

mixed getViewData()

Returns the data transformed by the value transformer.

Return Value

mixed

array getExtraData()

Returns the extra data.

Return Value

array The submitted data which do not belong to a child

FormConfigInterface getConfig()

Returns the form's configuration.

Return Value

FormConfigInterface The configuration

bool isSubmitted()

Returns whether the form is submitted.

Return Value

bool true if the form is submitted, false otherwise

string getName()

Returns the name by which the form is identified in forms.

Return Value

string The name of the form

PropertyPathInterface|null getPropertyPath()

Returns the property path that the form is mapped to.

Return Value

PropertyPathInterface|null The property path

$this addError(FormError $error)

Adds an error to this form.

Parameters

FormError $error

Return Value

$this

bool isValid()

Returns whether the form and all children are valid.

Return Value

bool

Exceptions

LogicException if the form is not submitted

bool 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.

Return Value

bool

bool 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.

Return Value

bool

bool isEmpty()

Returns whether the form is empty.

Return Value

bool

bool isSynchronized()

Returns whether the data in the different formats is synchronized.

If the data is not synchronized, you can get the transformation failure by calling {@link getTransformationFailure()}.

Return Value

bool

TransformationFailedException|null getTransformationFailure()

Returns the data transformation failure, if any.

Return Value

TransformationFailedException|null The transformation failure

$this initialize()

Initializes the form tree.

Should be called on the root form after constructing the tree.

Return Value

$this

$this 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.

Parameters

mixed $request The request to handle

Return Value

$this

$this submit(mixed $submittedData, bool $clearMissing = true)

Submits data to the button.

Parameters

mixed $submittedData The submitted data
bool $clearMissing Whether to set fields to NULL when they are missing in the submitted data

Return Value

$this

Exceptions

AlreadySubmittedException if the form has already been submitted

FormInterface getRoot()

Returns the root of the form tree.

Return Value

FormInterface The root of the tree

bool isRoot()

Returns whether the field is the root of the form tree.

Return Value

bool

FormView createView(FormView $parent = null)

Creates a view.

Parameters

FormView $parent

Return Value

FormView The view

int count()

Unsupported method.

Return Value

int Always returns 0

EmptyIterator getIterator()

Unsupported method.

Return Value

EmptyIterator Always returns an empty iterator

bool isClicked()

Returns whether this element was clicked.

Return Value

bool Whether this element was clicked