{# Widgets #} {% block color_widget %} {% apply spaceless %}
{% endapply %} {% endblock %} {% block choice_widget_expanded %} {% apply spaceless %}
{% for child in form %}
{{ form_label(child) }} {{ form_widget(child) }}
{% endfor %}
{% endapply %} {% endblock choice_widget_expanded %} {% block choice_widget_collapsed %} {% apply spaceless %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' form-control')|trim }) %} {% endapply %} {% endblock choice_widget_collapsed %} {% block form_widget_simple %} {% apply spaceless %} {% set type = type|default('text') %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' form-control' ~ (attr['maxlength'] is defined ? ' js-max-length-input' : ''))|trim }) %} {% endapply %} {% endblock form_widget_simple %} {% block textarea_widget %} {% apply spaceless %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' form-control ' ~ (attr['maxlength'] is defined ? ' js-max-length-input' : ''))|trim }) %} {% set reInitMethods = [] %} {% if attr['maxlength'] is defined %} {% set reInitMethods = reInitMethods|merge(['"charactersLeft"']) %} {% endif %} {% if 'js-rich-editor' in attr.class %} {% set reInitMethods = reInitMethods|merge(['"richEditor"']) %} {% endif %} {% endapply %} {% endblock textarea_widget %} {% block wysiwyg_widget %} {% apply spaceless %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' js-rich-editor rich-editor form-control')|trim }) %} {% if attr['maxlength'] is defined %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' js-max-length-input')|trim }) %} {% endif %} {% endapply %} {% endblock wysiwyg_widget %} {% block checkbox_widget %} {% apply spaceless %}
{% if required %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if label is empty %} {% set label = name|humanize %} {% endif %}
{% endapply %} {% endblock checkbox_widget %} {% block radio_widget %} {% apply spaceless %}
{% if required and not compound %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if label is empty %} {% set label = name|humanize %} {% endif %}
{% endapply %} {% endblock radio_widget %} {# Labels #} {% block form_label %} {% apply spaceless %} {% if 'checkbox' not in block_prefixes and label is not same as(false) %} {% set label_attr = label_attr|merge({'class': label_attr.class|default('')|trim}) %} {% if not compound %} {% set label_attr = label_attr|merge({'for': id}) %} {% endif %} {% if required %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if label is not same as(false) %} {% if label is empty %} {% set label = name|humanize %} {% endif %} {{ label|trans({}, translation_domain) }}{% if required %} *{% endif %} {% endif %} {% endif %} {% endapply %} {% endblock form_label %} {# Rows #} {% block form_row %} {% apply spaceless %}
{{ form_label(form) }} {% if attr['nested_form'] is defined and attr['nested_form'] == true %} {# Nested forms #} {% set sortable = false %} {% if attr['nested_sortable'] is defined and attr['nested_sortable'] == true %} {% set sortable = true %} {% set sortableField = attr['nested_sortable_field']|default('weight') %} {% endif %}
{# Items #} {% for obj in form %}
{# Header #}
{% if sortable %} {% endif %}
{% if sortable %} {% endif %}
{# View #}
{% if obj.vars.compound %} {{ form_widget(obj) }} {% else %} {% for child in obj.children %} {{ form_row(child) }} {% else %} {{ form_widget(obj) }} {% endfor %} {% endif %}
{% endfor %}
{% else %} {% set widget %} {{ form_widget(form) }} {% endset %} {% if attr['maxlength'] is defined %} {% set widget %}
{{ widget }}
{% endset %} {% endif %} {% if attr['info_text'] is defined %} {% set widget %}
{{ widget }} ?
{% endset %} {% endif %} {{ widget }} {% endif %} {% if attr['title'] is defined %}{% endif %} {{ form_errors(form) }}
{% endapply %} {% endblock form_row %} {# Misc #} {% block datetime_widget %} {% use 'form_div_layout.html.twig' with datetime_widget as base_datetime_widget %}
{{ block('base_datetime_widget') }}
{% endblock %} {% block date_widget %}
{% use 'form_div_layout.html.twig' with date_widget as base_date_widget %} {% if widget is defined and widget == 'single_text' %}
{{ block('base_date_widget') }}
{% else %} {{ block('base_date_widget') }} {% endif %}
{% endblock date_widget %} {% block time_widget %}
{% use 'form_div_layout.html.twig' with time_widget as base_time_widget %} {% set type = 'text' %} {% if widget is defined and widget == 'single_text' %}
{{ block('base_time_widget') }}
{% else %} {{ block('base_time_widget') }} {% endif %}
{% endblock time_widget %} {% block form_errors %} {% apply spaceless %} {% if errors|length > 0 %} {% for error in errors %} {{ error.message }} {% endfor %} {% endif %} {% endapply %} {% endblock form_errors %} {% block range_widget %} {% apply spaceless %}
{{ form_widget(form, {'type' : 'range', 'attr' : attr }) }}
{% endapply %} {% endblock %}