Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • SensioLabs Professional services to help you with Symfony
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by
  1. Home
  2. Documentation
  3. Reference
  4. Types
  5. csrf Field Type
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

Table of Contents

  • Overridden Options
    • property_path
  • Field Options
    • csrf_provider
    • intention
    • property_path

csrf Field Type

Edit this page

Warning: 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
  • 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.
TOC
    Version
    We stand with Ukraine.
    Version:
    Make sure your project is risk free

    Make sure your project is risk free

    Measure & Improve Symfony Code Performance

    Measure & Improve Symfony Code Performance

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of miqrogroove, a Symfony contributor

    Thanks miqrogroove for being a Symfony contributor

    4 commits • 15 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Deployed on

    Follow Symfony

    Search by Meilisearch