63 lines
2.0 KiB
Twig
63 lines
2.0 KiB
Twig
{% use 'form_div_layout.html.twig' %}
|
|
|
|
{%- block form_widget_simple -%}
|
|
{%- set type = type|default('text') -%}
|
|
{%- if type == 'range' or type == 'color' -%}
|
|
{# Attribute "required" is not supported #}
|
|
{%- set required = false -%}
|
|
{%- endif -%}
|
|
{%- if errors|length > 0 -%}
|
|
{% set attr = attr|merge({ 'aria-invalid': 'true', 'aria-describedby': 'error-' ~ id }) %}
|
|
{%- endif -%}
|
|
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
|
|
{%- endblock form_widget_simple -%}
|
|
|
|
{%- block form_row -%}
|
|
<fieldset{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
|
|
<legend>
|
|
<strong>
|
|
{{- label -}}
|
|
</strong>
|
|
</legend>
|
|
{{- form_widget(form) -}}
|
|
{{- form_errors(form) -}}
|
|
{{- form_help(form) -}}
|
|
</fieldset>
|
|
{%- endblock form_row -%}
|
|
|
|
{%- block form_errors -%}
|
|
{%- if errors|length > 0 -%}
|
|
<small id="error-{{ id }}">
|
|
{%- for error in errors -%}
|
|
<div>{{ error.message }}</div>
|
|
{%- endfor -%}
|
|
</small>
|
|
{%- endif -%}
|
|
{%- endblock form_errors -%}
|
|
|
|
{%- block choice_widget_expanded -%}
|
|
{%- for child in form %}
|
|
{{- form_widget(child) -}}
|
|
{% endfor -%}
|
|
{%- endblock choice_widget_expanded -%}
|
|
|
|
{%- block checkbox_widget -%}
|
|
<label for="{{ id }}">
|
|
{{ parent() }}
|
|
{{ label|trans|raw }}
|
|
{%- if attr.disabled is defined and attr.disabled == true and attr.checked == true -%}
|
|
<input type="hidden" name="{{ form.vars.full_name }}" value="{{ form.vars.value }}">
|
|
{%- endif -%}
|
|
</label>
|
|
{%- endblock checkbox_widget -%}
|
|
|
|
{%- block radio_widget -%}
|
|
<label for="{{ id }}">
|
|
{{ parent() }}
|
|
{{ label|trans|raw }}
|
|
</label>
|
|
{%- if attr.disabled is defined and attr.disabled == true and attr.checked == true -%}
|
|
<input type="hidden" name="{{ form.vars.full_name }}" value="{{ form.vars.value }}">
|
|
{%- endif -%}
|
|
{%- endblock radio_widget -%}
|