title: How to show label for overrided checkbox in Symfony Twig
body: <p>I've overrided the Twig template for my forms in my symfony application so that I could have more control over the labels for checkboxes.</p>
  
  <p>However, I am having problems with the checkbox label.</p>
  
  <p>Here is the code I overrided in my custom template file:</p>
  
  <pre><code>{# Labels #}
  {% block form_label %}
      {% spaceless %}
          {% if label is not sameas(false) %}
              {% if not compound %}
                  {% set label_attr = label_attr|merge({'for': id}) %}
              {% endif %}
              {% if required %}
                  {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
              {% endif %}
              {% if label is empty %}
                  {% set label = name|humanize %}
              {% endif %}
          {% endif %}
          {% if 'checkbox' not in block_prefixes %}
               &lt;label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}&gt;{{ label|trans({}, translation_domain) }}&lt;/label&gt;
          {% endif %}
      {% endspaceless %}
  {% endblock form_label %}
  
  {# Checkboxes #}
  {% block button_label %}{% endblock %}
  {% block checkbox_widget %}
  {% spaceless %}
      &lt;label for="{{ id }}"&gt;
          &lt;input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /&gt;
      {{ label }}&lt;/label&gt;
  {% endspaceless %}
  {% endblock checkbox_widget %}
  </code></pre>
  
  <p>It works fine but I can't get the label text node for checkboxes working.</p>
  
  <p>When I have a checkbox it generates something like:</p>
  
  <pre><code>&lt;label&gt;&lt;input type="checkbox"/&gt;&lt;/label&gt;
  </code></pre>
  
  <p>Where it should be:</p>
  
  <pre><code>&lt;label&gt;&lt;input type="checkbox"/&gt;Label Here&lt;/label&gt;
  </code></pre>
  
  <p>Any clue on how to make the label string apear after the checkbox?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I came to a solution, that worked pretty fine, but I am not sure if it the best.</p>
  
  <pre><code>{% block form_row %}
  {% spaceless %}
      &lt;div&gt;
          {{ form_errors(form) }}
          {% if 'checkbox'  in block_prefixes %}
              {{ form_widget(form) }}
              {{ form_label(form) }}
          {% elseif 'radio'  in block_prefixes %}
              {{ form_widget(form) }}
              {{ form_label(form) }}
          {% else %}
              {{ form_label(form) }}
              {{ form_widget(form) }}
          {% endif %}
  
      &lt;/div&gt;
  {% endspaceless %}
  {% endblock form_row %}
  </code></pre>