braincrafted/bootstrap-bundle

inline style does not display placeholder when label empty

GdotBdot opened this issue · 0 comments

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) %}