{% use 'bootstrap_4_horizontal_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 -%}
{% for attrname, attrvalue in attr %} {% if attrname == 'disabled' %}
{% endif %} {% endfor %} {%- if form_method != method -%} {%- endif -%} {%- endblock form_start -%} {%- block form_end -%} {%- if not render_rest is defined or render_rest -%} {{ form_rest(form) }} {%- endif -%} {% for attrname, attrvalue in attr %} {% if attrname == 'disabled' %}
{% endif %} {% endfor %}
{%- endblock form_end -%} {%- block form_widget -%} {% if compound %} {{- block('form_widget_compound') -}} {% else %} {{- block('form_widget_simple') -}} {% endif %} {% if help is defined %} {{ help }} {% endif %} {%- endblock form_widget -%} {% block form_widget_simple -%} {% if type is not defined or type != 'hidden' %} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control' ~ (type|default('') == 'file' ? '-file' : ''))|trim}) -%} {% endif %} {%- if type is defined and (type == 'range' or type == 'color') %} {# Attribute "required" is not supported #} {%- set required = false -%} {% endif %} {{ form_errors(form) }} {{- parent() -}} {%- endblock form_widget_simple %} {% block form_label -%} {%- if label is same as(false) -%}
{%- else -%} {%- if expanded is not defined or not expanded -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} {%- endif -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} {% if label is not same as(false) -%} {%- if compound is defined and compound -%} {%- set element = 'legend' -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} {%- else -%} {%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} {%- endif -%} {% if required -%} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} {%- endif -%} {% 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 -%} <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain)|raw }} {%- endif -%} {%- endif -%} {%- endblock form_label %} {%- block choice_widget -%} {{ form_errors(form) }} {{ parent() }} {%- endblock choice_widget -%} {%- block textarea_widget -%} {{ form_errors(form) }} {{ parent() }} {%- 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 -%} {% if help is defined and help is not null %} {% endif %} {%- endblock button_widget -%} {% block choice_widget_expanded -%} {%- for child in form %} {{- form_widget(child, { parent_label_class: label_attr.class|default(''), translation_domain: choice_translation_domain, valid: valid, }) -}} {% endfor -%} {%- endblock choice_widget_expanded %} {% block radio_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} {%- if 'radio-custom' in parent_label_class -%} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%}
{{- form_label(form, null, { widget: parent() }) -}}
{%- else -%} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} {{- form_label(form, null, { widget: block('inner_radio_widget') } ) -}} {%- endif -%} {%- endblock radio_widget %} {% block inner_radio_widget -%} {%- endblock inner_radio_widget %} {% block tetranz_select2entity_widget %} {% set attr = attr|merge({ 'data-ajax--url':remote_path, 'data-ajax--cache': cache ? 'true' : 'false', 'data-ajax--cache-timeout': cache_timeout|default(0), 'data-ajax--delay':delay, 'data-ajax--data-type':"json", 'data-language':language, 'data-minimum-input-length':minimum_input_length, 'data-placeholder':placeholder|trans({}, translation_domain), 'data-page-limit':page_limit, 'data-scroll':scroll ? 'true' : 'false', 'data-autostart':autostart ? 'true' : 'false', 'class' : (attr.class|default('') ~ ' select2entity form-control')|trim, 'data-name' : name|e('html_attr') }) %} {% if allow_add.enabled %} {% set attr = attr|merge({ 'data-tags':'true', 'data-tags-text':allow_add.new_tag_text|trans({}, translation_domain), 'data-new-tag-prefix':allow_add.new_tag_prefix|trans({}, translation_domain), 'data-token-separators':allow_add.tag_separators, }) %} {% endif %} {% if multiple %} {% set attr = attr|merge({'multiple':'multiple'}) %} {% endif %} {% if allow_clear %} {% set attr = attr|merge({'data-allow-clear': 'true'}) %} {% endif %} {% if width %} {% set attr = attr|merge({'data-width': width}) %} {% endif %} {% if class_type %} {% set attr = attr|merge({'data-classtype': class_type}) %} {% endif %} {{ form_errors(form) }} {% apply spaceless %} {% endapply %} {% endblock %}