Turn off screening in Symfony 2 / twig

I am creating a form using the form builder in Symfony. I add an attribute to the twig file for my flags, which contains the ampersand and pound sign, Symfony automatically exits the ampersand, which stops its display correctly. Do I need to disable shielding at all in the twig file or controller, or completely disable it in the configuration?

{{ form_widget(form.checkbox, { 'attr': {'data-icon-checkmark': '󰀦', 'data-icon-checkmark-checked': '󰀧'} }) }} 

I found several topics about this for Symfony versions 1.X, but nothing for 2.

Thanks!

+6
source share
2 answers

You probably need a raw tag or filter . Also look at the autoescape tag.

To disable auto-disconnect globally, set autoescape to false in config.yml :

 twig: # ... autoescape: false 
+13
source

Source: https://habr.com/ru/post/911538/


All Articles