Skip to content

Commit

Permalink
Use form_widget instead of defining templates inside form_row.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Hristov committed Jan 5, 2018
1 parent 94fdb9d commit bb0cfd6
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Resources/views/bootstrap_3_tab_layout.html.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{% block translations_row %}
<div class="form-group">
{{ form_label(form) }}

{{ block('nav_tabs') }}

{{ block('tab_contents') }}

{{ form_widget(form) }}
{{ form_errors(form) }}
</div>
{% endblock %}

{% block translations_widget %}
{{ block('nav_tabs') }}

{{ block('tab_contents') }}
{% endblock %}

{% block nav_tabs %}
<ul class="nav nav-tabs">
{% for key, child in form %}
Expand All @@ -18,15 +20,6 @@
</ul>
{% endblock %}

{% block nav_tab %}
<li {% if loop.first %}class="active"{% endif %}>
<a data-toggle="tab" href="#{{ key }}"
class="{% if not child.vars.valid %}has-error{% endif %}">
{{ form_label(child) }}
</a>
</li>
{% endblock %}

{% block tab_contents %}
<div class="tab-content">
{% for key, child in form %}
Expand All @@ -37,6 +30,15 @@
{{ form_errors(form) }}
{% endblock %}

{% block nav_tab %}
<li {% if loop.first %}class="active"{% endif %}>
<a data-toggle="tab" href="#{{ key }}"
class="{% if not child.vars.valid %}has-error{% endif %}">
{{ form_label(child) }}
</a>
</li>
{% endblock %}

{% block tab_content %}
<div id="{{ key }}" class="tab-pane fade {% if loop.first %}in active{% endif %}">
{{ form_widget(child) }}
Expand Down

0 comments on commit bb0cfd6

Please sign in to comment.