瀏覽代碼

Merge pull request #3034 from jvasseur/label_format

Add support for label_format in form_admin_fields.html.twig
Thomas 10 年之前
父節點
當前提交
88be7f9999
共有 1 個文件被更改,包括 8 次插入1 次删除
  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 %}