Ondrej Slinták Ondrej Slinták - 1 month ago 5x
PHP Question

How to render CSRF input in twig?

I know there's the usual way to render CSRF token hidden input with

, 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.


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