Skip to content

inline style does not display placeholder when label empty #350

@GdotBdot

Description

@GdotBdot

When a label is empty, but not explicitly set false, the name is used instead for regular labels. However, when using the inline style, the name is not shown as placeholder. I think this is inconsistent.
The reason can be found in the fields definition (BraincraftedBootstrapBundle:Form:bootstrap.html.twig), line 39 (block form_widget_simple):

{% if style == 'inline' and (attr.placeholder is not defined or attr.placeholder is empty)  and label != false %}
  {% if label is empty %}
    {% set attr = attr|merge({ 'placeholder': name|humanize }) %}
  {% else %}
    {% set attr = attr|merge({ 'placeholder': label}) %}
  {% endif %}
{% endif %}

The label != false comparision is not true if label is empty (thus, the next line does not make sense). I think it would be correct to do it as in line 562 (block form_label):

{% if label is not sameas(false) %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions