{% extends 'bootstrap_3_horizontal_layout.html.twig' %}
{#
ATTENTION:
when changing anything in this file, check if the changes need to be applied to form-theme.html.twig as well
#}
{% block form_errors %}
{% filter spaceless %}
{% if errors|length > 0 %}
{% for error in errors %}
{{ error.message }}
{% endfor %}
{% endif %}
{% endfilter %}
{% endblock form_errors %}
{% block widget_attributes %}
{% set types = form.vars.block_prefixes %}
{% set _class = '' %}
{% if 'checkbox' in types %}
{% set _class = ' checkbox' %}
{% elseif 'radio' in types%}
{% set _class = ' radio' %}
{% endif%}
{# % else %}
{% set _class = ' form-control' %}
{% endif %#}
{% if attr.class is defined %}
{% set class = attr.class ~ _class %}
{% else %}
{% set class = _class %}
{% endif %}
{% if 'checkbox' not in types and 'form-control' not in class %}
{% set class = class ~ ' form-control' %}
{% endif %}
{% set attr = attr|merge({'class' : class}) %}
{{ parent () }}
{% endblock widget_attributes %}
{% block choice_widget_expanded %}
{% filter spaceless %}
{% for child in form %}
{{ form_widget(child) }}
{% endfor %}
{% endfilter %}
{% endblock choice_widget_expanded %}
{% block choice_widget_collapsed %}
{% for att, val in attr %}
{% if att == 'class' %}
{% set att = val ~ ' form-control' %}
{% endif %}
{% endfor %}
{{ parent() }}
{% endblock %}
{% block checkbox_widget %}
{% filter spaceless %}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{% endif %}
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
{% if label is not same as(false) and label is empty %}
{% set label = name|humanize %}
{% endif %}
{% filter spaceless %}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{% endif %}
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
{% if label is not same as(false) and label is empty %}
{% set label = name|humanize %}
{% endif %}
{% if type is not defined or type != 'date' %}
{% if attr.class is defined %}
{% set class = attr.class ~ ' timepicker' %}
{% else %}
{% set class = ' timepicker' %}
{% endif %}
{% set attr = attr|merge({'class' : class, 'data-datepickerenable':'on'}) %}
{% endif %}
{{ block('form_widget_simple') }}
{% else %}
{% set date_pattern = '
' ~ date_pattern ~ '
'|raw %}
{{ date_pattern|replace({
'{{ year }}' : '
{% if type is not defined or type != 'time' %}
{% if attr.class is defined %}
{% set class = attr.class ~ ' timepicker' %}
{% else %}
{% set class = ' timepicker' %}
{% endif %}
{% set attr = attr|merge({'class' : class, 'data-timepicker':'on'}) %}
{% endif %}
{{ block('form_widget_simple') }}