FormConfigBuilder
in package
implements
FormConfigBuilderInterface
A basic form configuration.
Tags
Interfaces, Classes, Traits and Enums
- FormConfigBuilderInterface
- The configuration of a {@link Form} object.
Table of Contents
- $locked : mixed
- $action : string|null
- $attributes : mixed
- $autoInitialize : mixed
- $byReference : mixed
- $compound : mixed
- $data : mixed
- $dataClass : string|null
- $dataLocked : mixed
- $dataMapper : DataMapperInterface|null
- $disabled : mixed
- $dispatcher : mixed
- $emptyData : mixed
- $errorBubbling : mixed
- $formFactory : FormFactoryInterface|null
- $inheritData : mixed
- $mapped : mixed
- $method : mixed
- $modelTransformers : mixed
- $name : mixed
- $nativeRequestHandler : NativeRequestHandler
- Caches a globally unique {@link NativeRequestHandler} instance.
- $options : mixed
- $propertyPath : PropertyPathInterface|string|null
- $requestHandler : RequestHandlerInterface|null
- $required : mixed
- $type : ResolvedFormTypeInterface
- $viewTransformers : mixed
- __construct() : mixed
- Creates an empty form configuration.
- addEventListener() : $this
- Adds an event listener to an event on this form.
- addEventSubscriber() : $this
- Adds an event subscriber for events on this form.
- addModelTransformer() : $this
- Prepends / appends a transformer to the normalization transformer chain.
- addViewTransformer() : $this
- Appends / prepends a transformer to the view transformer chain.
- getAction() : mixed
- {@inheritdoc}
- getAttribute() : mixed
- {@inheritdoc}
- getAttributes() : mixed
- {@inheritdoc}
- getAutoInitialize() : mixed
- {@inheritdoc}
- getByReference() : mixed
- {@inheritdoc}
- getCompound() : mixed
- {@inheritdoc}
- getData() : mixed
- {@inheritdoc}
- getDataClass() : mixed
- {@inheritdoc}
- getDataLocked() : mixed
- {@inheritdoc}
- getDataMapper() : mixed
- {@inheritdoc}
- getDisabled() : mixed
- {@inheritdoc}
- getEmptyData() : mixed
- {@inheritdoc}
- getErrorBubbling() : mixed
- {@inheritdoc}
- getEventDispatcher() : mixed
- {@inheritdoc}
- getFormConfig() : FormConfigInterface
- Builds and returns the form configuration.
- getFormFactory() : mixed
- {@inheritdoc}
- getInheritData() : mixed
- {@inheritdoc}
- getMapped() : mixed
- {@inheritdoc}
- getMethod() : mixed
- {@inheritdoc}
- getModelTransformers() : mixed
- {@inheritdoc}
- getName() : mixed
- {@inheritdoc}
- getOption() : mixed
- {@inheritdoc}
- getOptions() : mixed
- {@inheritdoc}
- getPropertyPath() : mixed
- {@inheritdoc}
- getRequestHandler() : mixed
- {@inheritdoc}
- getRequired() : mixed
- {@inheritdoc}
- getType() : mixed
- {@inheritdoc}
- getViewTransformers() : mixed
- {@inheritdoc}
- hasAttribute() : mixed
- {@inheritdoc}
- hasOption() : mixed
- {@inheritdoc}
- isValidName() : bool
- Returns whether the given variable contains a valid form name.
- resetModelTransformers() : $this
- Clears the normalization transformers.
- resetViewTransformers() : $this
- Clears the view transformers.
- setAction() : $this
- Sets the target URL of the form.
- setAttribute() : $this
- Sets the value for an attribute.
- setAttributes() : $this
- Sets the attributes.
- setAutoInitialize() : $this
- Sets whether the form should be initialized automatically.
- setByReference() : $this
- Sets whether the form's data should be modified by reference.
- setCompound() : $this
- Sets whether the form should be compound.
- setData() : $this
- Sets the initial data of the form.
- setDataLocked() : $this
- Locks the form's data to the data passed in the configuration.
- setDataMapper() : $this
- Sets the data mapper used by the form.
- setDisabled() : $this
- Sets whether the form is disabled.
- setEmptyData() : $this
- Sets the data used for the client data when no value is submitted.
- setErrorBubbling() : $this
- Sets whether errors bubble up to the parent.
- setFormFactory() : mixed
- Sets the form factory used for creating new forms.
- setInheritData() : $this
- Sets whether the form should read and write the data of its parent.
- setMapped() : $this
- Sets whether the form should be mapped to an element of its parent's data.
- setMethod() : $this
- Sets the HTTP method used by the form.
- setPropertyPath() : $this
- Sets the property path that the form should be mapped to.
- setRequestHandler() : $this
- Sets the request handler used by the form.
- setRequired() : $this
- Sets whether this field is required to be filled out when submitted.
- setType() : $this
- Sets the resolved type.
Properties
$locked
protected
mixed
$locked
= false
$action
private
string|null
$action
$attributes
private
mixed
$attributes
= []
$autoInitialize
private
mixed
$autoInitialize
= false
$byReference
private
mixed
$byReference
= true
$compound
private
mixed
$compound
= false
$data
private
mixed
$data
$dataClass
private
string|null
$dataClass
$dataLocked
private
mixed
$dataLocked
= false
$dataMapper
private
DataMapperInterface|null
$dataMapper
$disabled
private
mixed
$disabled
= false
$dispatcher
private
mixed
$dispatcher
$emptyData
private
mixed
$emptyData
$errorBubbling
private
mixed
$errorBubbling
= false
$formFactory
private
FormFactoryInterface|null
$formFactory
$inheritData
private
mixed
$inheritData
= false
$mapped
private
mixed
$mapped
= true
$method
private
mixed
$method
= 'POST'
$modelTransformers
private
mixed
$modelTransformers
= []
$name
private
mixed
$name
$nativeRequestHandler
Caches a globally unique {@link NativeRequestHandler} instance.
private
static NativeRequestHandler
$nativeRequestHandler
$options
private
mixed
$options
$propertyPath
private
PropertyPathInterface|string|null
$propertyPath
$requestHandler
private
RequestHandlerInterface|null
$requestHandler
$required
private
mixed
$required
= true
$type
private
ResolvedFormTypeInterface
$type
$viewTransformers
private
mixed
$viewTransformers
= []
Methods
__construct()
Creates an empty form configuration.
public
__construct(string|null $name, string|null $dataClass, EventDispatcherInterface $dispatcher[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string|null
-
The form name
- $dataClass : string|null
-
The class of the form's data
- $dispatcher : EventDispatcherInterface
- $options : array<string|int, mixed> = []
Tags
Return values
mixed —addEventListener()
Adds an event listener to an event on this form.
public
addEventListener(mixed $eventName, mixed $listener, mixed $priority) : $this
Parameters
- $eventName : mixed
-
The name of the event to listen to
- $listener : mixed
-
The listener to execute
- $priority : mixed
-
The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority.
Return values
$this —The configuration object
addEventSubscriber()
Adds an event subscriber for events on this form.
public
addEventSubscriber(EventSubscriberInterface $subscriber) : $this
Parameters
- $subscriber : EventSubscriberInterface
Return values
$this —The configuration object
addModelTransformer()
Prepends / appends a transformer to the normalization transformer chain.
public
addModelTransformer(DataTransformerInterface $modelTransformer[, mixed $forceAppend = false ]) : $this
Parameters
- $modelTransformer : DataTransformerInterface
- $forceAppend : mixed = false
-
If set to true, append instead of prepending
Return values
$this —The configuration object
addViewTransformer()
Appends / prepends a transformer to the view transformer chain.
public
addViewTransformer(DataTransformerInterface $viewTransformer[, mixed $forcePrepend = false ]) : $this
Parameters
- $viewTransformer : DataTransformerInterface
- $forcePrepend : mixed = false
-
If set to true, prepend instead of appending
Return values
$this —The configuration object
getAction()
{@inheritdoc}
public
getAction() : mixed
Return values
mixed —getAttribute()
{@inheritdoc}
public
getAttribute(mixed $name[, mixed $default = null ]) : mixed
Parameters
- $name : mixed
- $default : mixed = null
Return values
mixed —getAttributes()
{@inheritdoc}
public
getAttributes() : mixed
Return values
mixed —getAutoInitialize()
{@inheritdoc}
public
getAutoInitialize() : mixed
Return values
mixed —getByReference()
{@inheritdoc}
public
getByReference() : mixed
Return values
mixed —getCompound()
{@inheritdoc}
public
getCompound() : mixed
Return values
mixed —getData()
{@inheritdoc}
public
getData() : mixed
Return values
mixed —getDataClass()
{@inheritdoc}
public
getDataClass() : mixed
Return values
mixed —getDataLocked()
{@inheritdoc}
public
getDataLocked() : mixed
Return values
mixed —getDataMapper()
{@inheritdoc}
public
getDataMapper() : mixed
Return values
mixed —getDisabled()
{@inheritdoc}
public
getDisabled() : mixed
Return values
mixed —getEmptyData()
{@inheritdoc}
public
getEmptyData() : mixed
Return values
mixed —getErrorBubbling()
{@inheritdoc}
public
getErrorBubbling() : mixed
Return values
mixed —getEventDispatcher()
{@inheritdoc}
public
getEventDispatcher() : mixed
Return values
mixed —getFormConfig()
Builds and returns the form configuration.
public
getFormConfig() : FormConfigInterface
Return values
FormConfigInterface —getFormFactory()
{@inheritdoc}
public
getFormFactory() : mixed
Return values
mixed —getInheritData()
{@inheritdoc}
public
getInheritData() : mixed
Return values
mixed —getMapped()
{@inheritdoc}
public
getMapped() : mixed
Return values
mixed —getMethod()
{@inheritdoc}
public
getMethod() : mixed
Return values
mixed —getModelTransformers()
{@inheritdoc}
public
getModelTransformers() : mixed
Return values
mixed —getName()
{@inheritdoc}
public
getName() : mixed
Return values
mixed —getOption()
{@inheritdoc}
public
getOption(mixed $name[, mixed $default = null ]) : mixed
Parameters
- $name : mixed
- $default : mixed = null
Return values
mixed —getOptions()
{@inheritdoc}
public
getOptions() : mixed
Return values
mixed —getPropertyPath()
{@inheritdoc}
public
getPropertyPath() : mixed
Return values
mixed —getRequestHandler()
{@inheritdoc}
public
getRequestHandler() : mixed
Return values
mixed —getRequired()
{@inheritdoc}
public
getRequired() : mixed
Return values
mixed —getType()
{@inheritdoc}
public
getType() : mixed
Return values
mixed —getViewTransformers()
{@inheritdoc}
public
getViewTransformers() : mixed
Return values
mixed —hasAttribute()
{@inheritdoc}
public
hasAttribute(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —hasOption()
{@inheritdoc}
public
hasOption(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —isValidName()
Returns whether the given variable contains a valid form name.
public
static isValidName(string|null $name) : bool
A name is accepted if it
- is empty
- starts with a letter, digit or underscore
- contains only letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":")
Parameters
- $name : string|null
Tags
Return values
bool —resetModelTransformers()
Clears the normalization transformers.
public
resetModelTransformers() : $this
Return values
$this —The configuration object
resetViewTransformers()
Clears the view transformers.
public
resetViewTransformers() : $this
Return values
$this —The configuration object
setAction()
Sets the target URL of the form.
public
setAction(mixed $action) : $this
Parameters
- $action : mixed
-
The target URL of the form
Return values
$this —The configuration object
setAttribute()
Sets the value for an attribute.
public
setAttribute(mixed $name, mixed $value) : $this
Parameters
- $name : mixed
-
The name of the attribute
- $value : mixed
-
The value of the attribute
Return values
$this —The configuration object
setAttributes()
Sets the attributes.
public
setAttributes(array<string|int, mixed> $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>
Return values
$this —The configuration object
setAutoInitialize()
Sets whether the form should be initialized automatically.
public
setAutoInitialize(mixed $initialize) : $this
Parameters
- $initialize : mixed
-
True to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call manually.
Return values
$this —The configuration object
setByReference()
Sets whether the form's data should be modified by reference.
public
setByReference(mixed $byReference) : $this
Parameters
- $byReference : mixed
-
Whether the data should be modified by reference
Return values
$this —The configuration object
setCompound()
Sets whether the form should be compound.
public
setCompound(mixed $compound) : $this
Parameters
- $compound : mixed
-
Whether the form should be compound
Return values
$this —The configuration object
setData()
Sets the initial data of the form.
public
setData(mixed $data) : $this
Parameters
- $data : mixed
-
The data of the form in model format
Return values
$this —The configuration object
setDataLocked()
Locks the form's data to the data passed in the configuration.
public
setDataLocked(mixed $locked) : $this
Parameters
- $locked : mixed
-
Whether to lock the default configured data
Return values
$this —The configuration object
setDataMapper()
Sets the data mapper used by the form.
public
setDataMapper([DataMapperInterface $dataMapper = null ]) : $this
Parameters
- $dataMapper : DataMapperInterface = null
Return values
$this —The configuration object
setDisabled()
Sets whether the form is disabled.
public
setDisabled(mixed $disabled) : $this
Parameters
- $disabled : mixed
-
Whether the form is disabled
Return values
$this —The configuration object
setEmptyData()
Sets the data used for the client data when no value is submitted.
public
setEmptyData(mixed $emptyData) : $this
Parameters
- $emptyData : mixed
-
The empty data
Return values
$this —The configuration object
setErrorBubbling()
Sets whether errors bubble up to the parent.
public
setErrorBubbling(mixed $errorBubbling) : $this
Parameters
- $errorBubbling : mixed
Return values
$this —The configuration object
setFormFactory()
Sets the form factory used for creating new forms.
public
setFormFactory(FormFactoryInterface $formFactory) : mixed
Parameters
- $formFactory : FormFactoryInterface
Return values
mixed —setInheritData()
Sets whether the form should read and write the data of its parent.
public
setInheritData(mixed $inheritData) : $this
Parameters
- $inheritData : mixed
-
Whether the form should inherit its parent's data
Return values
$this —The configuration object
setMapped()
Sets whether the form should be mapped to an element of its parent's data.
public
setMapped(mixed $mapped) : $this
Parameters
- $mapped : mixed
-
Whether the form should be mapped
Return values
$this —The configuration object
setMethod()
Sets the HTTP method used by the form.
public
setMethod(mixed $method) : $this
Parameters
- $method : mixed
-
The HTTP method of the form
Return values
$this —The configuration object
setPropertyPath()
Sets the property path that the form should be mapped to.
public
setPropertyPath(mixed $propertyPath) : $this
Parameters
- $propertyPath : mixed
-
The property path or null if the path should be set automatically based on the form's name
Return values
$this —The configuration object
setRequestHandler()
Sets the request handler used by the form.
public
setRequestHandler(RequestHandlerInterface $requestHandler) : $this
Parameters
- $requestHandler : RequestHandlerInterface
Return values
$this —The configuration object
setRequired()
Sets whether this field is required to be filled out when submitted.
public
setRequired(mixed $required) : $this
Parameters
- $required : mixed
Return values
$this —The configuration object
setType()
Sets the resolved type.
public
setType(ResolvedFormTypeInterface $type) : $this
Parameters
- $type : ResolvedFormTypeInterface
Return values
$this —The configuration object