Permalink
Browse files

[Form] Option for not displaying a label by setting label to false.

[Form] Fixed formatting & translation ..
  • Loading branch information...
1 parent 1ec59f1 commit 36e455680549bfe9fa5b1282e95bb9b36f2220be @BenjaminBeck BenjaminBeck committed with Sep 3, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
View
8 src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -227,10 +227,12 @@
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
- {% if label is empty %}
- {% set label = name|humanize %}
+ {% if label is not sameas(false) %}
+ {% if label is empty %}
+ {% set label = name|humanize %}
+ {% endif %}
+ <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
{% endif %}
- <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
{% endspaceless %}
{% endblock form_label %}

0 comments on commit 36e4556

Please sign in to comment.