{% use 'form_div_layout.html.twig' %} {%- block form_start -%} {%- set attr = attr|merge({class: ('ui ' ~ attr.class|default(''))|trim}) -%} {%- set attr = attr|merge({class: attr.class ~ ' form'}) -%} {{- parent() -}} {%- endblock form_start -%} {# Widgets #} {%- block button_widget -%} {%- set attr = attr|merge({class: ('ui ' ~ attr.class|default(''))|trim}) -%} {%- set attr = attr|merge({class: attr.class ~ ' button'}) -%} {{- parent() -}} {%- endblock %} {%- block choice_widget_collapsed -%} {%- set attr = attr|merge({class: ('ui ' ~ attr.class|default(''))|trim}) -%} {%- set attr = attr|merge({class: (attr.class ~ ' dropdown')}) -%} {{- parent() -}} {%- endblock choice_widget_collapsed -%} {%- block choice_widget_expanded -%}
{%- for child in form -%}
{{- form_widget(child) -}}
{%- endfor -%}
{%- endblock choice_widget_expanded -%} {%- block datetime_widget -%} {% spaceless %} {% if widget == 'single_text' %} {% set type = 'text' %} {{ block('form_widget_simple') }} {% else %}
{{ form_errors(form.date) }} {{ form_errors(form.time) }}
{{ form_widget(form.date) }}
{{ form_widget(form.time) }}
{% endif %} {% endspaceless %} {%- endblock datetime_widget -%} {%- block date_widget -%} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %}
{{ date_pattern|replace({ '{{ year }}': '
' ~ form_widget(form.year) ~ '
', '{{ month }}': '
' ~ form_widget(form.month) ~ '
', '{{ day }}': '
' ~ form_widget(form.day) ~ '
', })|raw }}
{% endif %} {% endspaceless %} {%- endblock date_widget -%} {%- block time_widget -%} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %} {% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
{{ form_widget(form.hour, vars) }}
:
{{ form_widget(form.minute, vars) }}
{% if with_seconds %}
:
{{ form_widget(form.second, vars) }}
{% endif %}
{% endif %} {% endspaceless %} {%- endblock time_widget %} {%- block dateinterval_widget -%} {{- block('form_widget_simple') -}} {# todo create a valid dateinterval widget #} {%- endblock dateinterval_widget -%} {%- block checkbox_widget -%} {% spaceless %}
{{ parent() }}
{% endspaceless %} {%- endblock checkbox_widget %} {%- block radio_widget -%} {% spaceless %} {% set attr = attr|merge({class: (attr.class|default('') ~ ' hidden')|trim}) %}
{{ parent() }}
{% endspaceless %} {%- endblock radio_widget %} {# Rows #} {%- block form_row -%}
{{- form_label(form) -}} {{- form_widget(form) -}}
{{- form_errors(form) -}} {%- endblock form_row -%} {%- block button_row -%}
{{- form_widget(form) -}}
{%- endblock button_row -%} {%- block checkbox_row -%}
{{- form_widget(form) -}}
{{- form_errors(form) -}} {%- endblock checkbox_row -%} {%- block radio_row -%}
{{- form_widget(form) -}}
{{- form_errors(form) -}} {%- endblock radio_row -%} {# Support #} {%- block form_errors -%} {% spaceless %} {% if errors|length > 0 %}
{% for error in errors %}
{{ error.message }}
{% endfor %}
{% endif %} {% endspaceless %} {%- endblock form_errors -%} {%- block row_attributes -%} {% spaceless %} {% set attr = {'class': 'field'} %} {% if required is defined and required %} {% set attr = attr|merge({class: 'required ' ~ attr.class}) %} {% endif %} {% if valid is defined and not valid %} {% set attr = attr|merge({class: attr.class ~ ' error'}) %} {% endif %} {{ block('attributes') }} {% endspaceless %} {%- endblock row_attributes -%}