Prechádzať zdrojové kódy

Merge pull request #1581 from tiagojsag/empty_value_translation

empty_value translation
Thomas 12 rokov pred
rodič
commit
d8350dffa2

+ 7 - 1
Resources/views/Form/form_admin_fields.html.twig

@@ -88,7 +88,13 @@ file that was distributed with this source code.
     {% else %}
     <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
         {% if empty_value is not none %}
-            <option value="">{{ empty_value|trans }}</option>
+            <option value="">
+                {% if not sonata_admin.admin %}
+                    {{- empty_value|trans({}, translation_domain) -}}
+                {% else %}
+                    {{- empty_value|trans({}, sonata_admin.field_description.translationDomain) -}}
+                {% endif%}
+            </option>
         {% endif %}
         {% if preferred_choices|length > 0 %}
             {% set options = preferred_choices %}