Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render CSRF input in twig?

I know there's the usual way to render CSRF token hidden input with form_rest, but is there a way to render just CSRF input itself? I've overridden {% block field_widget %} in theme to render a piece of additional text. But as CSRF token is rendered in input field too and I got a piece of text I don't need next to a hidden field. So I'd like to render it separately with an argument that tells it not to render this text.

like image 516
Ondrej Slinták Avatar asked Sep 19 '11 19:09

Ondrej Slinták


1 Answers

you can do it with {{ form_widget(formView._token) }}

like image 123
Henrik Bjørnskov Avatar answered Oct 08 '22 16:10

Henrik Bjørnskov