Skip to content

Commit 10df5d1

Browse files
author
Edvinas Klovas
committed
Currently if you want to use inline bootstrap form rendering, this is usually
enough: 1. Using bootstrap_3_layout.html.twig 2. Rendering form with `{{ form(form, { 'attr': {'class': 'form-inline'} }) }}` Form rendering breaks for buttons as the buttons are rendered in a separate <div> element without any attributes (this is coming from form_div_layout.html.twig which has this block hard-coded). The rest of the elements render with <div class="form-group"> which make them compatible with form-inline attribute in the form (`<form class="form-inline">`). The problem makes buttons render on new lines for inline forms. Extending button_row in bootstrap_3_layout.html.twig template fixes this. Signed-off-by: Edvinas Klovas <edvinas@pnd.io>
1 parent 90378ab commit 10df5d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@
181181
</div>
182182
{%- endblock form_row %}
183183

184+
{% block button_row -%}
185+
<div class="form-group">
186+
{{- form_widget(form) -}}
187+
</div>
188+
{%- endblock button_row %}
189+
184190
{% block choice_row -%}
185191
{% set force_error = true %}
186192
{{ block('form_row') }}

0 commit comments

Comments
 (0)