Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 36e4556

Browse files
BenjaminBeckstloyd
authored andcommitted
[Form] Option for not displaying a label by setting label to false.
[Form] Fixed formatting & translation ..
1 parent 1ec59f1 commit 36e4556

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,12 @@
227227
{% if required %}
228228
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
229229
{% endif %}
230-
{% if label is empty %}
231-
{% set label = name|humanize %}
230+
{% if label is not sameas(false) %}
231+
{% if label is empty %}
232+
{% set label = name|humanize %}
233+
{% endif %}
234+
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
232235
{% endif %}
233-
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
234236
{% endspaceless %}
235237
{% endblock form_label %}
236238

0 commit comments

Comments
 (0)