8000 [TwigBridge] Use label_format option for checkbox and radio labels · symfony/symfony@dc8f780 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc8f780

Browse files
committed
[TwigBridge] Use label_format option for checkbox and radio labels
1 parent 07673dc commit dc8f780

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,14 @@
167167
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
168168
{% endif %}
169169
{% if label is not same as(false) and label is empty %}
170-
{% set label = name|humanize %}
170+
{%- if label_format is not empty -%}
171+
{% set label = label_format|replace({
172+
'%name%': name,
173+
'%id%': id,
174+
}) %}
175+
{%- else -%}
176+
{% set label = name|humanize %}
177+
{%- endif -%}
171178
{% endif %}
172179
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
173180
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}

0 commit comments

Comments
 (0)
0