Skip to content

Commit 6fbd9a7

Browse files
committed
[TwigBridge] Use label_format option for checkbox and radio labels
1 parent 4ff05e0 commit 6fbd9a7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@
249249
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ parent_label_class)|trim}) %}
250250
{% endif %}
251251
{% if label is empty %}
252-
{% set label = name|humanize %}
252+
{%- if label_format is not empty -%}
253+
{% set label = label_format|replace({
254+
'%name%': name,
255+
'%id%': id,
256+
}) %}
257+
{%- else -%}
258+
{% set label = name|humanize %}
259+
{%- endif -%}
253260
{% endif %}
254261
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
255262
{{ widget|raw }}

0 commit comments

Comments
 (0)