{# Widgets #} {%- block form_widget -%} {% if compound %} {{- block('form_widget_compound') -}} {% else %} {{- block('form_widget_simple') -}} {% endif %} {%- endblock form_widget -%} {%- block form_widget_simple -%} {%- set type = type|default('text') -%} {%- if type == 'range' or type == 'color' -%} {# Attribute "required" is not supported #} {%- set required = false -%} {%- endif -%} {%- endblock form_widget_simple -%} {%- block form_widget_compound -%} {%- if form is rootform -%} {{ form_errors(form) }} {%- endif -%} {{- block('form_rows') -}} {{- form_rest(form) -}} {%- endblock form_widget_compound -%} {%- block collection_widget -%} {% if prototype is defined and not prototype.rendered %} {%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%} {% endif %} {{- block('form_widget') -}} {%- endblock collection_widget -%} {%- block textarea_widget -%} {%- endblock textarea_widget -%} {%- block choice_widget -%} {% if expanded %} {{- block('choice_widget_expanded') -}} {% else %} {{- block('choice_widget_collapsed') -}} {% endif %} {%- endblock choice_widget -%} {%- block choice_widget_expanded -%} {%- for child in form %} {{- form_widget(child) -}} {{- form_label(child, null, {translation_domain: choice_translation_domain}) -}} {% endfor -%} {%- endblock choice_widget_expanded -%} {%- block choice_widget_collapsed -%} {%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%} {% set required = false %} {%- endif -%} {%- endblock choice_widget_collapsed -%} {%- block choice_widget_options -%} {% for group_label, choice in options %} {%- if choice is iterable -%} {%- else -%} {%- endif -%} {% endfor %} {%- endblock choice_widget_options -%} {%- block checkbox_widget -%} {%- endblock checkbox_widget -%} {%- block radio_widget -%} {%- endblock radio_widget -%} {%- block datetime_widget -%} {% if widget == 'single_text' %} {{- block('form_widget_simple') -}} {%- else -%} {{- form_errors(form.date) -}} {{- form_errors(form.time) -}} {{- form_widget(form.date) -}} {{- form_widget(form.time) -}} {%- endif -%} {%- endblock datetime_widget -%} {%- block date_widget -%} {%- 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 -%} {%- endblock date_widget -%} {%- block time_widget -%} {%- if widget == 'single_text' -%} {{ block('form_widget_simple') }} {%- else -%} {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%} {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %} {%- endif -%} {%- endblock time_widget -%} {%- block dateinterval_widget -%} {%- if widget == 'single_text' -%} {{- block('form_widget_simple') -}} {%- else -%} {{- form_errors(form) -}}
{{ form_label(form.years) }} | {% endif -%} {%- if with_months %}{{ form_label(form.months) }} | {% endif -%} {%- if with_weeks %}{{ form_label(form.weeks) }} | {% endif -%} {%- if with_days %}{{ form_label(form.days) }} | {% endif -%} {%- if with_hours %}{{ form_label(form.hours) }} | {% endif -%} {%- if with_minutes %}{{ form_label(form.minutes) }} | {% endif -%} {%- if with_seconds %}{{ form_label(form.seconds) }} | {% endif -%}
---|---|---|---|---|---|---|
{{ form_widget(form.years) }} | {% endif -%} {%- if with_months %}{{ form_widget(form.months) }} | {% endif -%} {%- if with_weeks %}{{ form_widget(form.weeks) }} | {% endif -%} {%- if with_days %}{{ form_widget(form.days) }} | {% endif -%} {%- if with_hours %}{{ form_widget(form.hours) }} | {% endif -%} {%- if with_minutes %}{{ form_widget(form.minutes) }} | {% endif -%} {%- if with_seconds %}{{ form_widget(form.seconds) }} | {% endif -%}
{%- if translation_domain is same as(false) -%} {%- if help_html is same as(false) -%} {{- help -}} {%- else -%} {{- help|raw -}} {%- endif -%} {%- else -%} {%- if help_html is same as(false) -%} {{- help|trans(help_translation_parameters, translation_domain) -}} {%- else -%} {{- help|trans(help_translation_parameters, translation_domain)|raw -}} {%- endif -%} {%- endif -%}
{%- endif -%} {%- endblock form_help %} {# Rows #} {%- block repeated_row -%} {# No need to render the errors here, as all errors are mapped to the first child (see RepeatedTypeValidatorExtension). #} {{- block('form_rows') -}} {%- endblock repeated_row -%} {%- block form_row -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {{- form_label(form) -}} {{- form_errors(form) -}} {{- form_widget(form, widget_attr) -}} {{- form_help(form) -}} {%- endblock form_row -%} {%- block button_row -%} {{- form_widget(form) -}} {%- endblock button_row -%} {%- block hidden_row -%} {{ form_widget(form) }} {%- endblock hidden_row -%} {# Misc #} {%- block form -%} {{ form_start(form) }} {{- form_widget(form) -}} {{ form_end(form) }} {%- endblock form -%} {%- block form_start -%} {%- do form.setMethodRendered() -%} {% set method = method|upper %} {%- if method in ["GET", "POST"] -%} {% set form_method = method %} {%- else -%} {% set form_method = "POST" %} {%- endif -%} {%- endblock form_end -%} {%- block form_errors -%} {%- if errors|length > 0 -%}