2019-04-13 18:24:53 +02:00
|
|
|
{% extends 'bootstrap_4_horizontal_layout.html.twig' %}
|
|
|
|
|
|
|
|
{% block file_widget -%}
|
|
|
|
{%- set type = type|default('file') -%}
|
|
|
|
{{- block('form_widget_simple') -}}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
2019-04-13 18:28:41 +02:00
|
|
|
{% block form_label_class -%}
|
2020-01-04 21:42:44 +01:00
|
|
|
col-sm-3
|
2019-04-13 18:28:41 +02:00
|
|
|
{%- endblock form_label_class %}
|
|
|
|
|
|
|
|
{% block form_group_class -%}
|
2020-01-04 21:42:44 +01:00
|
|
|
col-sm-9
|
2019-08-13 23:04:06 +02:00
|
|
|
{%- endblock form_group_class %}
|
|
|
|
|
|
|
|
{%- block choice_widget_options -%}
|
|
|
|
{% for group_label, choice in options %}
|
|
|
|
{%- if choice is iterable -%}
|
|
|
|
<optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}">
|
|
|
|
{% set options = choice %}
|
|
|
|
{{- block('choice_widget_options') -}}
|
|
|
|
</optgroup>
|
|
|
|
{%- else -%}
|
|
|
|
{% if use_html_in_labels is defined and use_html_in_labels %}
|
|
|
|
<option value="{{ choice.value }}"{% if choice.attr %}{% with { attr: choice.attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label|raw : choice.label|trans({}, choice_translation_domain)|raw }}</option>
|
|
|
|
{% else %}
|
|
|
|
<option value="{{ choice.value }}"{% if choice.attr %}{% with { attr: choice.attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
|
|
|
|
{% endif %}
|
|
|
|
{%- endif -%}
|
|
|
|
{% endfor %}
|
2019-08-24 12:55:47 +02:00
|
|
|
{%- endblock choice_widget_options -%}
|
|
|
|
|
|
|
|
{% block si_unit_widget %}
|
2019-08-31 13:08:02 +02:00
|
|
|
<div class="input-group {% if sm %}input-group-sm{% endif %}">
|
2019-08-24 12:55:47 +02:00
|
|
|
{{ form_widget(form.value) }}
|
2019-08-31 13:08:02 +02:00
|
|
|
<div class="input-group-append {% if sm %}input-group-sm{% endif %}">
|
2019-08-24 12:55:47 +02:00
|
|
|
{% if form.prefix is defined %}
|
2019-08-31 13:08:02 +02:00
|
|
|
{{ form_widget(form.prefix, {'attr': {'class': 'custom-select'}}) }}
|
2019-08-24 12:55:47 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if unit is not empty %}
|
|
|
|
<label class="input-group-text">{{ unit }}</label>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-25 13:14:30 +02:00
|
|
|
{{ form_errors(form.value) }}
|
2019-09-10 17:12:56 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{#######################################################################################
|
|
|
|
#
|
|
|
|
# Definitions for Tristate Checkbox Type (mostly based on bootstrap checkbox type)
|
|
|
|
#
|
|
|
|
#######################################################################################}
|
|
|
|
|
|
|
|
{% block tristate_label -%}
|
|
|
|
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
|
|
|
|
{%- if widget is defined -%}
|
|
|
|
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %}
|
|
|
|
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %}
|
|
|
|
{%- if is_parent_custom or is_custom -%}
|
|
|
|
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
|
|
|
|
{%- else %}
|
|
|
|
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}
|
|
|
|
{%- endif %}
|
|
|
|
{%- 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 parent_label_class is defined -%}
|
|
|
|
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': ''})|trim}) -%}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- if label is not same as(false) and 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 -%}
|
|
|
|
|
|
|
|
{{ widget|raw }}
|
|
|
|
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
|
|
|
|
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain)) -}}
|
|
|
|
{{- form_errors(form) -}}
|
|
|
|
</label>
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endblock tristate_label %}
|
|
|
|
|
|
|
|
{%- block tr_parent -%}
|
|
|
|
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}{% if indeterminate %} indeterminate="indeterminate"{% endif %} />
|
|
|
|
{%- endblock tr_parent -%}
|
|
|
|
|
|
|
|
{% block tristate_widget -%}
|
|
|
|
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
|
|
|
|
{%- if 'checkbox-custom' in parent_label_class -%}
|
|
|
|
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%}
|
|
|
|
<div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' custom-control-inline' }}">
|
|
|
|
{{- form_label(form, null, { widget: block('tr_parent') }) -}}
|
|
|
|
</div>
|
|
|
|
{%- else -%}
|
|
|
|
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%}
|
|
|
|
<div class="form-check{{ 'checkbox-inline' in parent_label_class ? ' form-check-inline' }}">
|
|
|
|
{{- form_label(form, null, { widget: block('tr_parent') }) -}}
|
|
|
|
</div>
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endblock tristate_widget %}
|
|
|
|
|