interface FormBuilderInterface implements Traversable, Countable, FormConfigBuilderInterface
EventDispatcherInterface | getEventDispatcher() Returns the event dispatcher used to dispatch form events. | from FormConfigInterface |
string | getName() Returns the name of the form used as HTTP parameter. | from FormConfigInterface |
PropertyPathInterface|null | getPropertyPath() Returns the property path that the form should be mapped to. | from FormConfigInterface |
bool | getMapped() Returns whether the form should be mapped to an element of its parent's data. | from FormConfigInterface |
bool | getByReference() Returns whether the form's data should be modified by reference. | from FormConfigInterface |
bool | getInheritData() Returns whether the form should read and write the data of its parent. | from FormConfigInterface |
bool | getCompound() Returns whether the form is compound. | from FormConfigInterface |
ResolvedFormTypeInterface | getType() Returns the form types used to construct the form. | from FormConfigInterface |
DataTransformerInterface[] | getViewTransformers() Returns the view transformers of the form. | from FormConfigInterface |
DataTransformerInterface[] | getModelTransformers() Returns the model transformers of the form. | from FormConfigInterface |
DataMapperInterface|null | getDataMapper() Returns the data mapper of the form. | from FormConfigInterface |
bool | getRequired() Returns whether the form is required. | from FormConfigInterface |
bool | getDisabled() Returns whether the form is disabled. | from FormConfigInterface |
bool | getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. | from FormConfigInterface |
mixed | getEmptyData() Returns the data that should be returned when the form is empty. | from FormConfigInterface |
array | getAttributes() Returns additional attributes of the form. | from FormConfigInterface |
bool | hasAttribute(string $name) Returns whether the attribute with the given name exists. | from FormConfigInterface |
mixed | getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. | from FormConfigInterface |
mixed | getData() Returns the initial data of the form. | from FormConfigInterface |
string|null | getDataClass() Returns the class of the form data or null if the data is scalar or an array. | from FormConfigInterface |
bool | getDataLocked() Returns whether the form's data is locked. | from FormConfigInterface |
FormFactoryInterface | getFormFactory() Returns the form factory used for creating new forms. | from FormConfigInterface |
string | getAction() Returns the target URL of the form. | from FormConfigInterface |
string | getMethod() Returns the HTTP method used by the form. | from FormConfigInterface |
RequestHandlerInterface | getRequestHandler() Returns the request handler used by the form. | from FormConfigInterface |
bool | getAutoInitialize() Returns whether the form should be initialized upon creation. | from FormConfigInterface |
array | getOptions() Returns all options passed during the construction of the form. | from FormConfigInterface |
bool | hasOption(string $name) Returns whether a specific option exists. | from FormConfigInterface |
mixed | getOption(string $name, mixed $default = null) Returns the value of a specific option. | from FormConfigInterface |
$this | addEventListener(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. | from FormConfigBuilderInterface |
$this | addEventSubscriber(EventSubscriberInterface $subscriber) Adds an event subscriber for events on this form. | from FormConfigBuilderInterface |
$this | addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. | from FormConfigBuilderInterface |
$this | resetViewTransformers() Clears the view transformers. | from FormConfigBuilderInterface |
$this | addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. | from FormConfigBuilderInterface |
$this | resetModelTransformers() Clears the normalization transformers. | from FormConfigBuilderInterface |
$this | setAttribute(string $name, mixed $value) Sets the value for an attribute. | from FormConfigBuilderInterface |
$this | setAttributes(array $attributes) Sets the attributes. | from FormConfigBuilderInterface |
$this | setDataMapper(DataMapperInterface $dataMapper = null) Sets the data mapper used by the form. | from FormConfigBuilderInterface |
$this | setDisabled(bool $disabled) Set whether the form is disabled. | from FormConfigBuilderInterface |
$this | setEmptyData(mixed $emptyData) Sets the data used for the client data when no value is submitted. | from FormConfigBuilderInterface |
$this | setErrorBubbling(bool $errorBubbling) Sets whether errors bubble up to the parent. | from FormConfigBuilderInterface |
$this | setRequired(bool $required) Sets whether this field is required to be filled out when submitted. | from FormConfigBuilderInterface |
$this | setPropertyPath(string|PropertyPathInterface|null $propertyPath) Sets the property path that the form should be mapped to. | from FormConfigBuilderInterface |
$this | setMapped(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. | from FormConfigBuilderInterface |
$this | setByReference(bool $byReference) Sets whether the form's data should be modified by reference. | from FormConfigBuilderInterface |
$this | setInheritData(bool $inheritData) Sets whether the form should read and write the data of its parent. | from FormConfigBuilderInterface |
$this | setCompound(bool $compound) Sets whether the form should be compound. | from FormConfigBuilderInterface |
$this | setType(ResolvedFormTypeInterface $type) Set the types. | from FormConfigBuilderInterface |
$this | setData(mixed $data) Sets the initial data of the form. | from FormConfigBuilderInterface |
$this | setDataLocked(bool $locked) Locks the form's data to the data passed in the configuration. | from FormConfigBuilderInterface |
setFormFactory(FormFactoryInterface $formFactory) Sets the form factory used for creating new forms. | from FormConfigBuilderInterface | |
$this | setAction(string $action) Sets the target URL of the form. | from FormConfigBuilderInterface |
$this | setMethod(string $method) Sets the HTTP method used by the form. | from FormConfigBuilderInterface |
$this | setRequestHandler(RequestHandlerInterface $requestHandler) Sets the request handler used by the form. | from FormConfigBuilderInterface |
$this | setAutoInitialize(bool $initialize) Sets whether the form should be initialized automatically. | from FormConfigBuilderInterface |
FormConfigInterface | getFormConfig() Builds and returns the form configuration. | from FormConfigBuilderInterface |
FormBuilderInterface | add(string|int|FormBuilderInterface $child, string|null $type = null, array $options = array()) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten. | |
FormBuilderInterface | create(string $name, string|null $type = null, array $options = array()) Creates a form builder. | |
FormBuilderInterface | get(string $name) Returns a child by name. | |
FormBuilderInterface | remove(string $name) Removes the field with the given name. | |
bool | has(string $name) Returns whether a field with the given name exists. | |
array | all() Returns the children. | |
FormInterface | getForm() Creates the form. |
Returns the event dispatcher used to dispatch form events.
EventDispatcherInterface | The dispatcher |
Returns the name of the form used as HTTP parameter.
string | The form name |
Returns the property path that the form should be mapped to.
PropertyPathInterface|null | The property path |
Returns whether the form should be mapped to an element of its parent's data.
bool | Whether the form is mapped |
Returns whether the form's data should be modified by reference.
bool | Whether to modify the form's data by reference |
Returns whether the form should read and write the data of its parent.
bool | Whether the form should inherit its parent's data |
Returns whether the form is compound.
This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form.
bool | Whether the form is compound |
Returns the form types used to construct the form.
ResolvedFormTypeInterface | The form's type |
Returns the view transformers of the form.
DataTransformerInterface[] | An array of {@link DataTransformerInterface} instances |
Returns the model transformers of the form.
DataTransformerInterface[] | An array of {@link DataTransformerInterface} instances |
Returns the data mapper of the form.
DataMapperInterface|null | The data mapper |
Returns whether the form is required.
bool | Whether the form is required |
Returns whether the form is disabled.
bool | Whether the form is disabled |
Returns whether errors attached to the form will bubble to its parent.
bool | Whether errors will bubble up |
Returns the data that should be returned when the form is empty.
mixed | The data returned if the form is empty |
Returns additional attributes of the form.
array | An array of key-value combinations |
Returns whether the attribute with the given name exists.
string | $name | The attribute name |
bool | Whether the attribute exists |
Returns the value of the given attribute.
string | $name | The attribute name |
mixed | $default | The value returned if the attribute does not exist |
mixed | The attribute value |
Returns the initial data of the form.
mixed | The initial form data |
Returns the class of the form data or null if the data is scalar or an array.
string|null | The data class or null |
Returns whether the form's data is locked.
A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form.
bool | Whether the data is locked |
Returns the form factory used for creating new forms.
FormFactoryInterface | The form factory |
Returns the target URL of the form.
string | The target URL of the form |
Returns the HTTP method used by the form.
string | The HTTP method of the form |
Returns the request handler used by the form.
RequestHandlerInterface | The request handler |
Returns whether the form should be initialized upon creation.
bool | returns true if the form should be initialized when created, false otherwise |
Returns all options passed during the construction of the form.
array | The passed options |
Returns whether a specific option exists.
string | $name | The option name, |
bool | Whether the option exists |
Returns the value of a specific option.
string | $name | The option name |
mixed | $default | The value returned if the option does not exist |
mixed | The option value |
Adds an event listener to an event on this form.
string | $eventName | The name of the event to listen to |
callable | $listener | The listener to execute |
int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. |
$this | The configuration object |
Adds an event subscriber for events on this form.
EventSubscriberInterface | $subscriber |
$this | The configuration object |
Appends / prepends a transformer to the view transformer chain.
The transform method of the transformer is used to convert data from the normalized to the view format. The reverseTransform method of the transformer is used to convert from the view to the normalized format.
DataTransformerInterface | $viewTransformer | |
bool | $forcePrepend | If set to true, prepend instead of appending |
$this | The configuration object |
Clears the view transformers.
$this | The configuration object |
Prepends / appends a transformer to the normalization transformer chain.
The transform method of the transformer is used to convert data from the model to the normalized format. The reverseTransform method of the transformer is used to convert from the normalized to the model format.
DataTransformerInterface | $modelTransformer | |
bool | $forceAppend | If set to true, append instead of prepending |
$this | The configuration object |
Clears the normalization transformers.
$this | The configuration object |
Sets the value for an attribute.
string | $name | The name of the attribute |
mixed | $value | The value of the attribute |
$this | The configuration object |
Sets the attributes.
array | $attributes |
$this | The configuration object |
Sets the data mapper used by the form.
DataMapperInterface | $dataMapper |
$this | The configuration object |
Set whether the form is disabled.
bool | $disabled | Whether the form is disabled |
$this | The configuration object |
Sets the data used for the client data when no value is submitted.
mixed | $emptyData | The empty data |
$this | The configuration object |
Sets whether errors bubble up to the parent.
bool | $errorBubbling |
$this | The configuration object |
Sets whether this field is required to be filled out when submitted.
bool | $required |
$this | The configuration object |
Sets the property path that the form should be mapped to.
string|PropertyPathInterface|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name |
$this | The configuration object |
Sets whether the form should be mapped to an element of its parent's data.
bool | $mapped | Whether the form should be mapped |
$this | The configuration object |
Sets whether the form's data should be modified by reference.
bool | $byReference | Whether the data should be modified by reference |
$this | The configuration object |
Sets whether the form should read and write the data of its parent.
bool | $inheritData | Whether the form should inherit its parent's data |
$this | The configuration object |
Sets whether the form should be compound.
bool | $compound | Whether the form should be compound |
$this | The configuration object |
FormConfigInterface::getCompound |
Set the types.
ResolvedFormTypeInterface | $type |
$this | The configuration object |
Sets the initial data of the form.
mixed | $data | The data of the form in application format |
$this | The configuration object |
Locks the form's data to the data passed in the configuration.
A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form.
bool | $locked | Whether to lock the default data |
$this | The configuration object |
Sets the form factory used for creating new forms.
FormFactoryInterface | $formFactory |
Sets the target URL of the form.
string | $action | The target URL of the form |
$this | The configuration object |
Sets the HTTP method used by the form.
string | $method | The HTTP method of the form |
$this | The configuration object |
Sets the request handler used by the form.
RequestHandlerInterface | $requestHandler |
$this | The configuration object |
Sets whether the form should be initialized automatically.
Should be set to true only for root forms.
bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually |
$this | The configuration object |
Builds and returns the form configuration.
FormConfigInterface |
Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten.
If you add a nested group, this group should also be represented in the object hierarchy.
string|int|FormBuilderInterface | $child | |
string|null | $type | |
array | $options |
FormBuilderInterface |
Creates a form builder.
string | $name | The name of the form or the name of the property |
string|null | $type | The type of the form or null if name is a property |
array | $options | The options |
FormBuilderInterface |
Returns a child by name.
string | $name | The name of the child |
FormBuilderInterface |
InvalidArgumentException | if the given child does not exist |
Removes the field with the given name.
string | $name |
FormBuilderInterface |
Returns whether a field with the given name exists.
string | $name |
bool |
Returns the children.
array |
Creates the form.
FormInterface | The form |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Form/FormBuilderInterface.html