csrf Field Type
Edit this pageWarning: You are browsing the documentation for Symfony 2.0, which is no longer maintained.
Consider upgrading your projects to Symfony 6.3.
csrf Field Type
The csrf
type is a hidden input field containing a CSRF token.
Rendered as | input hidden field |
Options |
|
Overridden Options |
|
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
The CsrfProviderInterface
object that should generate the CSRF token.
If not set, this defaults to the default provider.
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