Skip to content

Commit

Permalink
Fix expanded widget inline-btn to use buttons when widget type set. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
isometriks authored Feb 3, 2017
1 parent f376768 commit 6b64245
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Resources/views/Form/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,14 @@

{% block choice_widget_expanded %}
{% spaceless %}
{% set tagName = 'label' %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default(''))}) %}
{% set label_attr = label_attr|merge({'class': (label_attr.class ~ ' ' ~ (widget_type != '' ? (multiple ? 'checkbox' : 'radio') ~ '-' ~ widget_type : ''))}) %}
{% if expanded %}
{% set attr = attr|merge({'class': attr.class|default('') ~ ' ' ~ horizontal_input_wrapper_class}) %}
{% endif %}
{% if widget_type == 'inline-btn' %}
{% set tagName = 'button' %}
<div class="btn-group" data-toggle="buttons">
{% endif %}
{% for child in form %}
Expand All @@ -219,15 +221,15 @@
{% else %}
{% set label_attr_copy = label_attr|default({}) %}
{% endif %}
<button{% for attrname, attrvalue in label_attr_copy %} {{ attrname }}="{{ attrvalue }}"{% endfor %}
<{{ tagName }}{% for attrname, attrvalue in label_attr_copy %} {{ attrname }}="{{ attrvalue }}"{% endfor %}
{%- if disabled %} disabled="disabled"{% endif -%}>
{{ form_widget(child, {'horizontal_label_class': horizontal_label_class, 'horizontal_input_wrapper_class': horizontal_input_wrapper_class, 'attr': {'class': attr.widget_class|default('') }}) }}
{% if widget_type == 'inline-btn' or widget_checkbox_label == 'widget'%}
{{ child.vars.label|trans({}, translation_domain)|raw }}
{% else %}
{{ child.vars.label|trans({}, translation_domain) }}
{% endif %}
</button>
</{{ tagName }}>
{% if widget_type not in ['inline', 'inline-btn'] %}
</div>
{% endif %}
Expand Down

0 comments on commit 6b64245

Please sign in to comment.