8000 No Bootstrap markup is rendered for label set as false by jongotlin · Pull Request #18504 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

No Bootstrap markup is rendered for label set as false #18504

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

Closed
wants to merge 1 commit into from
Closed
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
No Bootstrap markup is rendered for label set as false
  • Loading branch information
jongotlin committed Apr 11, 2016
commit 1fb1a3fbdfbde91ce04803a50026b8c03557d9ae
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ col-sm-2
{# Rows #}

{% block form_row -%}
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
{{- form_label(form) -}}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_errors(form) -}}
{% set displayMarkup = form.children|length == 0 or form.vars.label is not same as(false) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should not change the behavior when form.children|length == 0 imo.
This is not a bug, other templates show the label, and may be part of the work in progress feature in #17609.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's a bug displaying a form-group inside a form-group. The label i still shown - the markup is not rendered when the label is set to false.
I cannot see how this will be solved in your pr. It looks like another feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I misread the condition, IIUC you force the label (even false) to be printed when there is no child.
So I guess this should be right.

{%- if displayMarkup -%}
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
{{- form_label(form) -}}
<div class="{{ block('form_group_class') }}">
{%- endif -%}
{{- form_widget(form) -}}
{{- form_errors(form) -}}
{%- if displayMarkup -%}
</div>
</div>
{##}</div>
{%- endif -%}
{%- endblock form_row %}

{% block checkbox_row -%}
Expand Down
0