Skip to content

Commit 59429f3

Browse files
bug #28469 [Form][TwigBridge] fix not displaying labels when value is false (xabbuh)
This PR was merged into the 4.1 branch. Discussion ---------- [Form][TwigBridge] fix not displaying labels when value is false | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28198 | License | MIT | Doc PR | Commits ------- c4a6c9fa00 fix not displaying labels when value is false
2 parents d353a78 + bc70be0 commit 59429f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Resources/views/Form/bootstrap_base_layout.html.twig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@
6464
{%- if datetime is not defined or not datetime -%}
6565
<div {{ block('widget_container_attributes') -}}>
6666
{%- endif %}
67+
{%- if label is not same as(false) -%}
6768
<div class="sr-only">
6869
{{ form_label(form.year) }}
6970
{{ form_label(form.month) }}
7071
{{ form_label(form.day) }}
7172
</div>
73+
{%- endif -%}
7274

7375
{{- date_pattern|replace({
7476
'{{ year }}': form_widget(form.year),
@@ -89,10 +91,10 @@
8991
{%- if datetime is not defined or false == datetime -%}
9092
<div {{ block('widget_container_attributes') -}}>
9193
{%- endif -%}
92-
<div class="sr-only">{{ form_label(form.hour) }}</div>
94+
{%- if label is not same as(false) -%}<div class="sr-only">{{ form_label(form.hour) }}</div>{%- endif -%}
9395
{{- form_widget(form.hour) -}}
94-
{%- if with_minutes -%}:<div class="sr-only">{{ form_label(form.minute) }}</div>{{ form_widget(form.minute) }}{%- endif -%}
95-
{%- if with_seconds -%}:<div class="sr-only">{{ form_label(form.second) }}</div>{{ form_widget(form.second) }}{%- endif -%}
96+
{%- if with_minutes -%}:{%- if label is not same as(false) -%}<div class="sr-only">{{ form_label(form.minute) }}</div>{%- endif -%}{{ form_widget(form.minute) }}{%- endif -%}
97+
{%- if with_seconds -%}:{%- if label is not same as(false) -%}<div class="sr-only">{{ form_label(form.second) }}</div>{%- endif -%}{{ form_widget(form.second) }}{%- endif -%}
9698
{%- if datetime is not defined or false == datetime -%}
9799
</div>
98100
{%- endif -%}

0 commit comments

Comments
 (0)