October 18, 2017 Javier Eguiluz

Symfony Forms let you apply one or more themes globally to all the forms of your application. For example, just by adding this config, your forms will be beautifully formatted for Bootstrap 4:

1 2 3 # app/config/config.yml twig : form_themes : [ 'bootstrap_4_layout.html.twig' ]

However, global themes provide little flexibility because they are applied unconditionally. That's why in Symfony 3.4 we improved the form_theme Twig tag to let you disable global form themes.

If you want a specific form to not use the global themes, define its themes with the form_theme Twig tag and add the only keyword at the end of it:

1 2 3 {% form_theme form with [ 'common.html.twig' , 'form/fields.html.twig' ] only %} {# ... #}