user7342807
user7342807

Reputation: 313

How do I integrate Bootstrap3 into Symfony3?

I looked everywhere but I can't find a documentation on how to apply bootstrap styles to Symfony, or twig to be precise.

Many answers are outdated as they are mostly about Symfony 2.x with bootstrap3.

For reference, I am trying to add a style to

{{ form_start(form))}}
{{ form_widget(form) }}
{{ form_end(form) }}

Upvotes: 0

Views: 122

Answers (1)

Veve
Veve

Reputation: 6758

Since Symfony 2.6, Bootstrap is included in Symfony without the need for a specific bundle, as announced in this news, and explained in the doc here.

There are 2 layouts available, the normal layout and the horizontal one.

To apply it everywhere:

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

Or only for specific forms, add this at the top of the corresponding Twig files:

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

Upvotes: 3

Related Questions