Explorar el Código

Merge pull request #3034 from jvasseur/label_format

Add support for label_format in form_admin_fields.html.twig
Thomas hace 10 años
padre
commit
88be7f9999
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      Resources/views/Form/form_admin_fields.html.twig

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

@@ -99,7 +99,14 @@ file that was distributed with this source code.
         {% endif %}
 
         {% if label is empty %}
-            {% set label = name|humanize %}
+            {%- if label_format is not empty -%}
+                {% set label = label_format|replace({
+                    '%name%': name,
+                    '%id%': id,
+                }) %}
+            {%- else -%}
+                {% set label = name|humanize %}
+            {%- endif -%}
         {% endif %}
 
         {% if in_list_checkbox is defined and in_list_checkbox and widget is defined %}