ZaquPL
ZaquPL

Reputation: 799

Bootstrap form theme in Symfony 3.1

I would like to know how to include a form theme designed for Bootstrap 3. This option was introduced in Symfony 2.6, but in Symfony 3.1 it was moved or deleted, becouse this solution does not work as it should: New in Symfony 2.6: Bootstrap form theme.

When I tried to set:

twig:
debug:            "%kernel.debug%"
strict_variables: "%kernel.debug%"
form:
    resources: ['bootstrap_3_layout.html.twig']

I got this message:

Fatal error: Uncaught exception 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException' with message 'Unrecognized option "form" under "twig"' in ...

I know about

{% form_theme form 'bootstrap_3_layout.html.twig' %}

and it works very well, but I want to set this theme permanently in a config file.

Upvotes: 6

Views: 8837

Answers (1)

Alsatian
Alsatian

Reputation: 3135

I think the config key changed.

Try :

# app/config/config.yml
twig:
    form_themes:
        - 'bootstrap_3_layout.html.twig'
    # ...

http://symfony.com/doc/current/cookbook/form/form_customization.html#twig

Upvotes: 29

Related Questions