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

Skip to content

[Form][TwigBridge] fix not displaying labels when value is false #28469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@
{%- if datetime is not defined or not datetime -%}
<div {{ block('widget_container_attributes') -}}>
{%- endif %}
{%- if label is not same as(false) -%}
<div class="sr-only">
{{ form_label(form.year) }}
{{ form_label(form.month) }}
{{ form_label(form.day) }}
</div>
{%- endif -%}

{{- date_pattern|replace({
'{{ year }}': form_widget(form.year),
Expand All @@ -89,10 +91,10 @@
{%- if datetime is not defined or false == datetime -%}
<div {{ block('widget_container_attributes') -}}>
{%- 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) -}}
{%- if with_minutes -%}:<div class="sr-only">{{ form_label(form.minute) }}</div>{{ form_widget(form.minute) }}{%- endif -%}
{%- if with_seconds -%}:<div class="sr-only">{{ form_label(form.second) }}</div>{{ form_widget(form.second) }}{%- 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 -%}:{%- 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 -%}
</div>
{%- endif -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'invalid_message_parameters',
)));

if (false === $options['label']) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change technically could go into the 2.8 branch too. Though it would only fix custom form themes there. Our built-in form themes do not suffer from this issue in older branches.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #28508

$dateOptions['label'] = false;
$timeOptions['label'] = false;
}

if (null !== $options['date_widget']) {
$dateOptions['widget'] = $options['date_widget'];
}
Expand Down