Skip to content

Commit d34caee

Browse files
committed
merged and unified blocks field_label and form_label into generic_label
1 parent e8ea852 commit d34caee

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,25 @@
182182

183183
{# Labels #}
184184

185-
{% block field_label %}
185+
{% block generic_label %}
186186
{% spaceless %}
187187
{% if required %}
188188
{% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
189189
{% endif %}
190-
<label for="{{ id }}"{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}</label>
190+
<label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}</label>
191+
{% endspaceless %}
192+
{% endblock %}
193+
194+
{% block field_label %}
195+
{% spaceless %}
196+
{% set attr = attr|merge({'for': id}) %}
197+
{{ block('generic_label') }}
191198
{% endspaceless %}
192199
{% endblock field_label %}
193200

194201
{% block form_label %}
195202
{% spaceless %}
196-
{% if required %}
197-
{% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
198-
{% endif %}
199-
<label {% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}</label>
203+
{{ block('generic_label') }}
200204
{% endspaceless %}
201205
{% endblock form_label %}
202206

0 commit comments

Comments
 (0)