Forráskód Böngészése

Allow disabling translation on form fields (#4454)

This is what Symfony does in its Twig integration bundle, we should do
the same.
Grégoire Paris 8 éve
szülő
commit
c53736c2de

+ 3 - 0
Resources/doc/reference/translation.rst

@@ -102,6 +102,9 @@ over-rides that setting for one of the fields:
         ->end()
     ;
 
+Translation can also be disabled on a specific field by setting
+``translation_domain`` to ``false``.
+
 Setting the label name
 ^^^^^^^^^^^^^^^^^^^^^^
 

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

@@ -131,7 +131,9 @@ file that was distributed with this source code.
         {% endif %}
 
         <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
-            {% if not sonata_admin.admin %}
+            {% if translation_domain is same as(false) %}
+                {{- label -}}
+            {% elseif not sonata_admin.admin %}
                 {{- label|trans({}, translation_domain) -}}
             {% else %}
                 {{ label|trans({}, sonata_admin.field_description.translationDomain ?: admin.translationDomain) }}