{% use '_forms/standard_form_theme.html.twig' with
    form_label as parent_form_label,
    form_help as parent_form_help
%}

{% block checkbox_label %}
  {{- block('parent_form_label') -}}
{% endblock checkbox_label %}

{% block checkbox_row -%}
  <div class="flow-slim">
    {{ form_errors(form) }}
    <div class="form-flex form-flex--single-line form-flex--no-collapse">
      <span class="form-flex__align" aria-hidden="true"></span>
      {{ form_widget(form) }}
      {{ form_label(form) }}
    </div>
    {{ form_help(form) }}
  </div>
{%- endblock checkbox_row %}

{% block form_label %}
  {%- if not (no_align ?? false) -%}
    {%- set label_attr = label_attr|merge({class: (label_attr.class ?? '')~' form-flex__align text-align-right'}) -%}
  {%- endif -%}
  {{- block('parent_form_label') -}}
{% endblock form_label %}

{%- block form_row -%}
  <div class="flow-slim">
    {{- form_errors(form) -}}
    <div class="form-flex form-flex--single-line">
      {{- form_label(form) -}}
      {{- form_widget(form) -}}
    </div>
    {{- form_help(form) -}}
  </div>
{%- endblock form_row -%}

{%- block form_help -%}
  {%- if help -%}
    <div class="form-flex form-flex--single-line">
      <div class="form-flex__align" aria-hidden="true"></div>
      {{ block('parent_form_help') }}
    </div>
  {%- endif -%}
{%- endblock form_help -%}

{%- block dateinterval_widget -%}
  {%- if widget == 'single_text' -%}
    {{- block('form_widget_simple') -}}
  {%- else -%}
    <div {{ block('widget_container_attributes') }}>
      {{- form_errors(form) -}}
      <table class="{{ table_class|default('') }}" role="presentation">
        <thead>
          <tr>
            {%- if with_years %}<th>{{ form_label(form.years, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_months %}<th>{{ form_label(form.months, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_weeks %}<th>{{ form_label(form.weeks, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_days %}<th>{{ form_label(form.days, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_hours %}<th>{{ form_label(form.hours, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_minutes %}<th>{{ form_label(form.minutes, null, { no_align: true }) }}</th>{% endif -%}
            {%- if with_seconds %}<th>{{ form_label(form.seconds, null, { no_align: true }) }}</th>{% endif -%}
          </tr>
        </thead>
        <tbody>
          <tr>
            {%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%}
            {%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%}
            {%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%}
            {%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%}
            {%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%}
            {%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%}
            {%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%}
          </tr>
        </tbody>
      </table>
      {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%}
    </div>
  {%- endif -%}
{%- endblock dateinterval_widget -%}
