WARNING: You are browsing the documentation for Symfony 2.0 which is not maintained anymore. Consider upgrading your projects to Symfony 4.1.

csrf Field Type

2.0 version

csrf Field Type

The csrf type is a hidden input field containing a CSRF token.

Rendered as input hidden field
Options
  • csrf_provider
  • intention
Overridden Options
  • property_path
Parent type hidden
Class CsrfType

Overridden Options

property_path

default: false

A Csrf field must not be mapped to the object, so this option defaults to false.

Field Options

csrf_provider

type: Symfony\Component\Form\CsrfProvider\CsrfProviderInterface

The CsrfProviderInterface object that should generate the CSRF token. If not set, this defaults to the default provider.

intention

type: string

An optional unique identifier used to generate the CSRF token.

property_path

type: any default: the field's value

Fields display a property value of the form's domain object by default. When the form is submitted, the submitted value is written back into the object.

If you want to override the property that a field reads from and writes to, you can set the property_path option. Its default value is the field's name.

If you wish the field to be ignored when reading or writing to the object you can set the property_path option to false

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.