|
@@ -151,15 +151,20 @@ file that was distributed with this source code.
|
|
|
|
|
|
{% block choice_widget_collapsed %}
|
|
|
{% spaceless %}
|
|
|
- {% if required and empty_value is none and not empty_value_in_choices and not multiple %}
|
|
|
+
|
|
|
+ {# this line only work with sf<3, as empty_value_in_choices and empty_value are now deprecated#}
|
|
|
+ {% if required and empty_value is defined and empty_value_in_choices is defined and empty_value is none and not empty_value_in_choices and not multiple %}
|
|
|
{% set required = false %}
|
|
|
{% endif %}
|
|
|
+
|
|
|
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
|
|
|
{% if (sortable is defined) and sortable and multiple %}
|
|
|
{{ block('sonata_type_choice_multiple_sortable') }}
|
|
|
{% else %}
|
|
|
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %} >
|
|
|
- {% if empty_value is not none %}
|
|
|
+
|
|
|
+ {# this line only work with sf<3, as empty_value_in_choices and empty_value are now deprecated#}
|
|
|
+ {% if empty_value is defined and empty_value is not none %}
|
|
|
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>
|
|
|
{% if not sonata_admin.admin %}
|
|
|
{{- empty_value|trans({}, translation_domain) -}}
|