{% extends 'form_div_layout.html.twig' %}
{%- 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_label -%}
{%- endblock form_label -%}
{% block form_widget_simple %}
{% if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{%- if translation_domain is not same as(false) -%}
{% set label = label|trans({}, translation_domain) %}
{%- endif -%}
{% set type = type|default('text') %}
{% if 'number' in block_prefixes %}
{% set type = 'number' %}
{% endif %}
{%- if type == 'text' or type == 'number' -%}
{%- if type == 'number' -%}
{% set value = value | trans | replace({",": "."}) %}
{%- endif -%}
{%- elseif type == 'file' -%}
{%- elseif type == 'color' -%}
{%- else -%}
{%- endif -%}
{% endblock form_widget_simple %}
{%- block textarea_widget -%}
{%- if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{%- if translation_domain is not same as(false) -%}
{% set label = label|trans({}, translation_domain) %}
{%- endif -%}
{%- if attr.codeEditor is not defined or attr.codeEditor == false -%}
{{ value|default('') }}
{%- else -%}
{%- endif -%}
{%- endblock textarea_widget -%}
{%- block button_widget -%}
{%- if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- elseif label is same as(false) -%}
{% set translation_domain = false %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
{%- if attr | length > 0 and attr.icon is defined -%}
{%- endif -%}
{%- endblock button_widget -%}
{%- block choice_widget_collapsed -%}
{% if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{%- if translation_domain is not same as(false) -%}
{% set label = label|trans({}, translation_domain) %}
{%- endif -%}
{%- 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 -%}
{% set values = [] %}
{%- if placeholder is not none -%}
{% set option = {'value': '', 'label': placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)), 'selected': required and value is empty} %}
{% set values = values|merge([option]) %}
{%- endif -%}
{%- if preferred_choices|length > 0 -%}
{%- set options = preferred_choices -%}
{% for group_label, choice in options %}
{% set option = {'value': choice.value, 'label': choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain), 'selected': choice is selectedchoice(value)} %}
{% set values = values|merge([option]) %}
{% endfor %}
{%- if choices|length > 0 and separator is not none -%}
{% set option = {'disabled': true, 'label': separator} %}
{% set values = values|merge([option]) %}
{%- endif -%}
{%- endif -%}
{%- set options = choices -%}
{% for group_label, choice in options %}
{% set option = {'value': choice.value, 'label': choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain), 'selected': choice is selectedchoice(value)} %}
{% set values = values|merge([option]) %}
{% endfor %}
{%- endblock choice_widget_collapsed -%}
{% block datetime_widget -%}
{%- if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{%- if translation_domain is not same as(false) -%}
{% set label = label|trans({}, translation_domain) %}
{%- endif -%}
{{- form_widget(form.date, { datetime: true, label: label } ) -}}
{{- form_widget(form.time, { datetime: true } ) -}}
{%- endblock datetime_widget %}
{% block date_widget -%}
{%- endblock date_widget %}
{% block time_widget -%}
{%- endblock time_widget %}
{%- block checkbox_widget -%}
{% if label is not empty %}{{ label }}{% endif %}
{%- endblock checkbox_widget -%}