W3cubDocs

/Symfony 2.7

Symfony\Component\Form\ButtonBuilder

class ButtonBuilder implements IteratorAggregate, FormBuilderInterface

A builder for {@link Button} instances.

Methods

__construct(string $name, array $options = array())

Creates a new button builder.

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

Unsupported method.

FormBuilderInterface create(string $name, string|FormTypeInterface $type = null, array $options = array())

Unsupported method.

FormBuilderInterface get(string $name)

Unsupported method.

FormBuilderInterface remove(string $name)

Unsupported method.

bool has(string $name)

Unsupported method.

array all()

Returns the children.

Button getForm()

Creates the button.

FormConfigBuilderInterface addEventListener(string $eventName, callable $listener, int $priority)

Unsupported method.

FormConfigBuilderInterface addEventSubscriber(EventSubscriberInterface $subscriber)

Unsupported method.

FormConfigBuilderInterface addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false)

Unsupported method.

FormConfigBuilderInterface resetViewTransformers()

Unsupported method.

FormConfigBuilderInterface addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false)

Unsupported method.

FormConfigBuilderInterface resetModelTransformers()

Unsupported method.

FormConfigBuilderInterface setAttribute(string $name, mixed $value)

Sets the value for an attribute.

FormConfigBuilderInterface setAttributes(array $attributes)

Sets the attributes.

FormConfigBuilderInterface setDataMapper(DataMapperInterface $dataMapper = null)

Unsupported method.

ButtonBuilder setDisabled(bool $disabled)

Set whether the button is disabled.

FormConfigBuilderInterface setEmptyData(mixed $emptyData)

Unsupported method.

FormConfigBuilderInterface setErrorBubbling(bool $errorBubbling)

Unsupported method.

FormConfigBuilderInterface setRequired(bool $required)

Unsupported method.

FormConfigBuilderInterface setPropertyPath(null $propertyPath)

Unsupported method.

FormConfigBuilderInterface setMapped(bool $mapped)

Unsupported method.

FormConfigBuilderInterface setByReference(bool $byReference)

Unsupported method.

setVirtual(bool $virtual)

Unsupported method.

FormConfigBuilderInterface setCompound(bool $compound)

Unsupported method.

ButtonBuilder setType(ResolvedFormTypeInterface $type)

Sets the type of the button.

FormConfigBuilderInterface setData(mixed $data)

Unsupported method.

FormConfigBuilderInterface setDataLocked(bool $locked)

Unsupported method.

setFormFactory(FormFactoryInterface $formFactory)

Unsupported method.

FormConfigBuilderInterface setAction(string $action)

Unsupported method.

FormConfigBuilderInterface setMethod(string $method)

Unsupported method.

FormConfigBuilderInterface setRequestHandler(RequestHandlerInterface $requestHandler)

Unsupported method.

ButtonBuilder setAutoInitialize(bool $initialize)

Unsupported method.

FormConfigBuilderInterface setInheritData(bool $inheritData)

Unsupported method.

FormConfigInterface getFormConfig()

Builds and returns the button configuration.

null getEventDispatcher()

Unsupported method.

string getName()

Returns the name of the form used as HTTP parameter.

null getPropertyPath()

Unsupported method.

bool getMapped()

Unsupported method.

bool getByReference()

Unsupported method.

bool getVirtual()

Unsupported method.

bool getCompound()

Unsupported method.

ResolvedFormTypeInterface getType()

Returns the form type used to construct the button.

array getViewTransformers()

Unsupported method.

array getModelTransformers()

Unsupported method.

null getDataMapper()

Unsupported method.

bool getRequired()

Unsupported method.

bool getDisabled()

Returns whether the button is disabled.

bool getErrorBubbling()

Unsupported method.

null getEmptyData()

Unsupported method.

array getAttributes()

Returns additional attributes of the button.

bool hasAttribute(string $name)

Returns whether the attribute with the given name exists.

mixed getAttribute(string $name, mixed $default = null)

Returns the value of the given attribute.

null getData()

Unsupported method.

null getDataClass()

Unsupported method.

bool getDataLocked()

Unsupported method.

null getFormFactory()

Unsupported method.

null getAction()

Unsupported method.

null getMethod()

Unsupported method.

null getRequestHandler()

Unsupported method.

bool getAutoInitialize()

Unsupported method.

bool getInheritData()

Unsupported method.

array getOptions()

Returns all options passed during the construction of the button.

bool hasOption(string $name)

Returns whether a specific option exists.

mixed getOption(string $name, mixed $default = null)

Returns the value of a specific option.

int count()

Unsupported method.

EmptyIterator getIterator()

Unsupported method.

Details

public __construct(string $name, array $options = array())

Creates a new button builder.

Parameters

string $name The name of the button.
array $options The button's options.

Exceptions

InvalidArgumentException If the name is empty.

public FormBuilderInterface add(string|int|FormBuilderInterface $child, string|FormTypeInterface $type = null, array $options = array())

Unsupported method.

This method should not be invoked.

Parameters

string|int|FormBuilderInterface $child
string|FormTypeInterface $type
array $options

Return Value

FormBuilderInterface The builder object.

Exceptions

BadMethodCallException

public FormBuilderInterface create(string $name, string|FormTypeInterface $type = null, array $options = array())

Unsupported method.

This method should not be invoked.

Parameters

string $name The name of the form or the name of the property
string|FormTypeInterface $type The type of the form or null if name is a property
array $options The options

Return Value

FormBuilderInterface The created builder.

Exceptions

BadMethodCallException

public FormBuilderInterface get(string $name)

Unsupported method.

This method should not be invoked.

Parameters

string $name The name of the child

Return Value

FormBuilderInterface The builder for the child

Exceptions

BadMethodCallException

public FormBuilderInterface remove(string $name)

Unsupported method.

This method should not be invoked.

Parameters

string $name

Return Value

FormBuilderInterface The builder object.

Exceptions

BadMethodCallException

public bool has(string $name)

Unsupported method.

Parameters

string $name

Return Value

bool Always returns false.

public array all()

Returns the children.

Return Value

array Always returns an empty array.

public Button getForm()

Creates the button.

Return Value

Button The button

public FormConfigBuilderInterface addEventListener(string $eventName, callable $listener, int $priority)

Unsupported method.

This method should not be invoked.

Parameters

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.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface addEventSubscriber(EventSubscriberInterface $subscriber)

Unsupported method.

This method should not be invoked.

Parameters

EventSubscriberInterface $subscriber The subscriber to attach.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false)

Unsupported method.

This method should not be invoked.

Parameters

DataTransformerInterface $viewTransformer
bool $forcePrepend if set to true, prepend instead of appending

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface resetViewTransformers()

Unsupported method.

This method should not be invoked.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false)

Unsupported method.

This method should not be invoked.

Parameters

DataTransformerInterface $modelTransformer
bool $forceAppend if set to true, append instead of prepending

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface resetModelTransformers()

Unsupported method.

This method should not be invoked.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setAttribute(string $name, mixed $value)

Sets the value for an attribute.

Parameters

string $name The name of the attribute
mixed $value The value of the attribute

Return Value

FormConfigBuilderInterface The configuration object.

public FormConfigBuilderInterface setAttributes(array $attributes)

Sets the attributes.

Parameters

array $attributes The attributes.

Return Value

FormConfigBuilderInterface The configuration object.

public FormConfigBuilderInterface setDataMapper(DataMapperInterface $dataMapper = null)

Unsupported method.

This method should not be invoked.

Parameters

DataMapperInterface $dataMapper

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public ButtonBuilder setDisabled(bool $disabled)

Set whether the button is disabled.

Parameters

bool $disabled Whether the button is disabled

Return Value

ButtonBuilder The button builder.

public FormConfigBuilderInterface setEmptyData(mixed $emptyData)

Unsupported method.

This method should not be invoked.

Parameters

mixed $emptyData The empty data.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setErrorBubbling(bool $errorBubbling)

Unsupported method.

This method should not be invoked.

Parameters

bool $errorBubbling

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setRequired(bool $required)

Unsupported method.

This method should not be invoked.

Parameters

bool $required

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setPropertyPath(null $propertyPath)

Unsupported method.

This method should not be invoked.

Parameters

null $propertyPath The property path or null if the path should be set automatically based on the form's name.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setMapped(bool $mapped)

Unsupported method.

This method should not be invoked.

Parameters

bool $mapped Whether the form should be mapped.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setByReference(bool $byReference)

Unsupported method.

This method should not be invoked.

Parameters

bool $byReference Whether the data should be modified by reference.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public setVirtual(bool $virtual)

Unsupported method.

This method should not be invoked.

Parameters

bool $virtual

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setCompound(bool $compound)

Unsupported method.

This method should not be invoked.

Parameters

bool $compound Whether the form should be compound.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public ButtonBuilder setType(ResolvedFormTypeInterface $type)

Sets the type of the button.

Parameters

ResolvedFormTypeInterface $type The type of the button.

Return Value

ButtonBuilder The button builder.

public FormConfigBuilderInterface setData(mixed $data)

Unsupported method.

This method should not be invoked.

Parameters

mixed $data The data of the form in application format.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setDataLocked(bool $locked)

Unsupported method.

This method should not be invoked.

Parameters

bool $locked Whether to lock the default data.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public setFormFactory(FormFactoryInterface $formFactory)

Unsupported method.

This method should not be invoked.

Parameters

FormFactoryInterface $formFactory The form factory.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setAction(string $action)

Unsupported method.

Parameters

string $action The target URL of the form.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setMethod(string $method)

Unsupported method.

Parameters

string $method The HTTP method of the form.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setRequestHandler(RequestHandlerInterface $requestHandler)

Unsupported method.

Parameters

RequestHandlerInterface $requestHandler

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public ButtonBuilder setAutoInitialize(bool $initialize)

Unsupported method.

Parameters

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.

Return Value

ButtonBuilder The configuration object.

Exceptions

BadMethodCallException

public FormConfigBuilderInterface setInheritData(bool $inheritData)

Unsupported method.

Parameters

bool $inheritData Whether the form should inherit its parent's data.

Return Value

FormConfigBuilderInterface The configuration object.

Exceptions

BadMethodCallException

public FormConfigInterface getFormConfig()

Builds and returns the button configuration.

Return Value

FormConfigInterface

public null getEventDispatcher()

Unsupported method.

Return Value

null Always returns null.

public string getName()

Returns the name of the form used as HTTP parameter.

Return Value

string The form name.

public null getPropertyPath()

Unsupported method.

Return Value

null Always returns null.

public bool getMapped()

Unsupported method.

Return Value

bool Always returns false.

public bool getByReference()

Unsupported method.

Return Value

bool Always returns false.

public bool getVirtual()

Unsupported method.

Return Value

bool Always returns false.

public bool getCompound()

Unsupported method.

Return Value

bool Always returns false.

public ResolvedFormTypeInterface getType()

Returns the form type used to construct the button.

Return Value

ResolvedFormTypeInterface The button's type.

public array getViewTransformers()

Unsupported method.

Return Value

array Always returns an empty array.

public array getModelTransformers()

Unsupported method.

Return Value

array Always returns an empty array.

public null getDataMapper()

Unsupported method.

Return Value

null Always returns null.

public bool getRequired()

Unsupported method.

Return Value

bool Always returns false.

public bool getDisabled()

Returns whether the button is disabled.

Return Value

bool Whether the button is disabled.

public bool getErrorBubbling()

Unsupported method.

Return Value

bool Always returns false.

public null getEmptyData()

Unsupported method.

Return Value

null Always returns null.

public array getAttributes()

Returns additional attributes of the button.

Return Value

array An array of key-value combinations.

public bool hasAttribute(string $name)

Returns whether the attribute with the given name exists.

Parameters

string $name The attribute name.

Return Value

bool Whether the attribute exists.

public mixed getAttribute(string $name, mixed $default = null)

Returns the value of the given attribute.

Parameters

string $name The attribute name.
mixed $default The value returned if the attribute does not exist.

Return Value

mixed The attribute value.

public null getData()

Unsupported method.

Return Value

null Always returns null.

public null getDataClass()

Unsupported method.

Return Value

null Always returns null.

public bool getDataLocked()

Unsupported method.

Return Value

bool Always returns false.

public null getFormFactory()

Unsupported method.

Return Value

null Always returns null.

public null getAction()

Unsupported method.

Return Value

null Always returns null.

public null getMethod()

Unsupported method.

Return Value

null Always returns null.

public null getRequestHandler()

Unsupported method.

Return Value

null Always returns null.

public bool getAutoInitialize()

Unsupported method.

Return Value

bool Always returns false.

public bool getInheritData()

Unsupported method.

Return Value

bool Always returns false.

public array getOptions()

Returns all options passed during the construction of the button.

Return Value

array The passed options.

public bool hasOption(string $name)

Returns whether a specific option exists.

Parameters

string $name The option name,

Return Value

bool Whether the option exists.

public mixed getOption(string $name, mixed $default = null)

Returns the value of a specific option.

Parameters

string $name The option name.
mixed $default The value returned if the option does not exist.

Return Value

mixed The option value.

public int count()

Unsupported method.

Return Value

int Always returns 0.

public EmptyIterator getIterator()

Unsupported method.

Return Value

EmptyIterator Always returns an empty iterator.

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/Form/ButtonBuilder.html