0
我正在使用symfony2和內置的樹枝默認引導程序水平佈局。symfony2 boostrap 3佈局保留複選框的標籤,即使標籤設置爲false
我面對的問題是當呈現一個複選框'label'=> false時,表單中還有一個控制標籤和一個奇怪的填充。
我試圖通過everride添加以下代碼模板,但後來我得到兩個標籤,當標籤未設置爲false:
{% extends "bootstrap_3_horizontal_layout.html.twig" %}
{% block checkbox_radio_label %}
{% if required %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
{% if parent_label_class is defined %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ parent_label_class)|trim}) %}
{% endif %}
{% if label is empty %}
{{ widget|raw }}
{% else %}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
{{ widget|raw }}
{{ label|trans({}, translation_domain) }}
</label>
{% endif %}
{% endblock checkbox_radio_label %}
{% block checkbox_widget -%}
{% set parent_label_class = parent_label_class|default('') %}
{% if 'checkbox-inline' in parent_label_class %}
{{ form_label(form, null, { widget: parent() }) }}
{% else %}
{% if label is empty %}
<div align="center" class="fmu_single_label">
{{ form_label(form, null, { widget: parent() }) }}
</div>
{% else %}
<div class="checkbox">
{{ form_label(form, null, { widget: parent() }) }}
</div>
{% endif %}
{% endif %}
{%- endblock checkbox_widget %}
如何糾正這種任何想法?