Class

Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension

class FormTypeCsrfExtension extends AbstractTypeExtension

Methods

buildForm(FormBuilder $builder, array $options)

Adds a CSRF field to the form when the CSRF protection is enabled.

buildView(FormView $view, FormInterface $form)

Builds the view.

from AbstractTypeExtension
buildViewBottomUp(FormView $view, FormInterface $form)

Removes CSRF fields from all the form views except the root one.

array getDefaultOptions(array $options)

Overrides the default options form the extended type.

array getAllowedOptionValues(array $options)

Returns the allowed option values for each option (if any).

from AbstractTypeExtension
__construct($enabled = true, $fieldName = '_token')

string getExtendedType()

Returns the name of the type being extended

Details

at line 38
public buildForm(FormBuilder $builder, array $options)

Adds a CSRF field to the form when the CSRF protection is enabled.

Parameters

FormBuilder $builder The form builder
array $options The options

in AbstractTypeExtension at line 42
public buildView(FormView $view, FormInterface $form)

Builds the view.

This method gets called after the extended type has built the view to further modify it.

Parameters

FormView $view The view
FormInterface $form The form

See also

FormTypeInterface::buildView()

at line 65
public buildViewBottomUp(FormView $view, FormInterface $form)

Removes CSRF fields from all the form views except the root one.

Parameters

FormView $view The form view
FormInterface $form The form

at line 79
public array getDefaultOptions(array $options)

Overrides the default options form the extended type.

Parameters

array $options

Return Value

array

in AbstractTypeExtension at line 80
public array getAllowedOptionValues(array $options)

Returns the allowed option values for each option (if any).

Parameters

array $options

Return Value

array The allowed option values

at line 26
public __construct($enabled = true, $fieldName = '_token')

Parameters

$enabled
$fieldName

at line 92
public string getExtendedType()

Returns the name of the type being extended

Return Value

string The name of the type being extended