fix not displaying labels when value is false
This commit is contained in:
parent
a3e6e8300c
commit
c4a6c9fa00
@ -64,11 +64,13 @@
|
|||||||
{%- if datetime is not defined or not datetime -%}
|
{%- if datetime is not defined or not datetime -%}
|
||||||
<div {{ block('widget_container_attributes') -}}>
|
<div {{ block('widget_container_attributes') -}}>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if label is not same as(false) -%}
|
||||||
<div class="sr-only">
|
<div class="sr-only">
|
||||||
{{ form_label(form.year) }}
|
{{ form_label(form.year) }}
|
||||||
{{ form_label(form.month) }}
|
{{ form_label(form.month) }}
|
||||||
{{ form_label(form.day) }}
|
{{ form_label(form.day) }}
|
||||||
</div>
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
{{- date_pattern|replace({
|
{{- date_pattern|replace({
|
||||||
'{{ year }}': form_widget(form.year),
|
'{{ year }}': form_widget(form.year),
|
||||||
@ -89,10 +91,10 @@
|
|||||||
{%- if datetime is not defined or false == datetime -%}
|
{%- if datetime is not defined or false == datetime -%}
|
||||||
<div {{ block('widget_container_attributes') -}}>
|
<div {{ block('widget_container_attributes') -}}>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<div class="sr-only">{{ form_label(form.hour) }}</div>
|
{%- if label is not same as(false) -%}<div class="sr-only">{{ form_label(form.hour) }}</div>{%- endif -%}
|
||||||
{{- form_widget(form.hour) -}}
|
{{- form_widget(form.hour) -}}
|
||||||
{%- if with_minutes -%}:<div class="sr-only">{{ form_label(form.minute) }}</div>{{ form_widget(form.minute) }}{%- endif -%}
|
{%- 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 -%}
|
||||||
{%- if with_seconds -%}:<div class="sr-only">{{ form_label(form.second) }}</div>{{ form_widget(form.second) }}{%- endif -%}
|
{%- 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 -%}
|
||||||
{%- if datetime is not defined or false == datetime -%}
|
{%- if datetime is not defined or false == datetime -%}
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -133,6 +133,11 @@ class DateTimeType extends AbstractType
|
|||||||
'invalid_message_parameters',
|
'invalid_message_parameters',
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
if (false === $options['label']) {
|
||||||
|
$dateOptions['label'] = false;
|
||||||
|
$timeOptions['label'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (null !== $options['date_widget']) {
|
if (null !== $options['date_widget']) {
|
||||||
$dateOptions['widget'] = $options['date_widget'];
|
$dateOptions['widget'] = $options['date_widget'];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user