Skip to content

Commit 6857f24

Browse files
arcanisgkwouterj
authored andcommitted
Warn about the _token field added automatically
documentation is incomplete the variable form._token is missing: https://symfony.com/doc/current/form/form_customization.html#form-variables-reference
1 parent eabddbd commit 6857f24

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

form/form_customization.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ control over how each form field is rendered, so you can fully customize them:
7474
</div>
7575
</div>
7676

77+
.. caution::
78+
79+
If you're rendering each field manually, make sure you don't forget the
80+
``_token`` field that is automatically added for CSRF protection.
81+
82+
You can also use ``{{ form_rest(form) }}`` (recommended) to render any
83+
fields that aren't rendered manually. See
84+
:ref:`the form_rest() documentation <reference-forms-twig-rest>` below for
85+
more information.
86+
7787
.. note::
7888

7989
Later in this article you can find the full reference of these Twig

0 commit comments

Comments
 (0)