chill-bundles/Resources/views/Form/fields.html.twig

83 lines
2.8 KiB
Twig

{% block form_row %}
{% spaceless %}
<div class="{% spaceless %}
{% if attr.class is defined and ('cf-title' in attr.class or 'cf-fields' in attr.class ) %}
grid-12
{% elseif attr.class is defined and 'multiple-cf-inline' in attr.class %}
grid-2 grid-mobile-4 grid-tablet-4 mobile-clear tablet-clear
{% else %}
grid-4 clear
{% endif %}
{% endspaceless %}">
{% if attr.class is not defined or ('cf-title' not in attr.class and 'cf-fields' not in attr.class ) %}
{{ form_label(form) }}
{% endif %}
</div>
<div class="{% spaceless %}
{% if attr.class is defined and 'cf-title' in attr.class %}
grid-12
{% elseif attr.class is defined and 'cf-fields' in attr.class %}
grid-12 parent
{% elseif attr.class is defined and 'multiple-cf-inline' in attr.class %}
grid-2 grid-mobile-8 grid-tablet-8 multiple-cf-inline
{% else %}
grid-8
{% endif %}
{% endspaceless %}">
{{ form_widget(form) }}
{{ form_errors(form) }}
</div>
{% endspaceless %}
{% endblock form_row %}
{% block choice_widget_expanded %}
{% spaceless %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
{% endfor %}
</div>
{% endspaceless %}
{% endblock choice_widget_expanded %}
{% block choice_with_other_widget %}
{% spaceless %}
{% for child in form._choices %}
<div class="blop">
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
</div>
{% endfor %}
{{ form_widget(form._other, {'attr': {'class': 'input-text-other-value'} }) }}
{% endspaceless %}
{% endblock choice_with_other_widget %}
{% block date_widget %}
{% spaceless %}
{% if widget == 'single_text' %}
{% set attr = {'class' : 'input datepicker'} %}
{{ block('form_widget_simple') }}
{% else %}
<div {{ block('widget_container_attributes') }}>
{{ date_pattern|replace({
'{{ year }}': form_widget(form.year ),
'{{ month }}': form_widget(form.month ),
'{{ day }}': form_widget(form.day ),
})|raw }}
</div>
{% endif %}
{% endspaceless %}
{% endblock date_widget %}
{% block form_errors %}
{% spaceless %}
{% if errors|length > 0 %}
<ul class="errors">
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endspaceless %}
{% endblock form_errors %}