|
209 | 209 | {%- endblock submit_widget %}
|
210 | 210 |
|
211 | 211 | {%- block checkbox_widget -%}
|
212 |
| - {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} |
| 212 | + {%- set attr_class = attr_class|default(attr.class|default('')) -%} |
| 213 | + {%- set row_class = '' -%} |
| 214 | + {%- if 'btn-check' not in attr_class -%} |
| 215 | + {%- set attr_class = attr_class ~ ' form-check-input' -%} |
| 216 | + {%- set row_class = 'form-check' -%} |
| 217 | + {%- endif -%} |
| 218 | + {%- set attr = attr|merge({class: attr_class|trim}) -%} |
213 | 219 | {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
|
214 |
| - {%- set row_class = 'form-check' -%} |
215 | 220 | {%- if 'checkbox-inline' in parent_label_class %}
|
216 | 221 | {% set row_class = row_class ~ ' form-check-inline' %}
|
217 | 222 | {% endif -%}
|
218 | 223 | {%- if 'checkbox-switch' in parent_label_class %}
|
219 | 224 | {% set row_class = row_class ~ ' form-switch' %}
|
220 | 225 | {% endif -%}
|
221 |
| - <div class="{{ row_class }}"> |
222 |
| - {{- form_label(form, null, { widget: parent() }) -}} |
223 |
| - </div> |
| 226 | + {%- if row_class is not empty -%} |
| 227 | + <div class="{{ row_class }}"> |
| 228 | + {%- endif -%} |
| 229 | + {{- form_label(form, null, { widget: parent() }) -}} |
| 230 | + {%- if row_class is not empty -%} |
| 231 | + </div> |
| 232 | + {%- endif -%} |
224 | 233 | {%- endblock checkbox_widget %}
|
225 | 234 |
|
226 | 235 | {%- block radio_widget -%}
|
227 |
| - {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} |
| 236 | + {%- set attr_class = attr_class|default(attr.class|default('')) -%} |
| 237 | + {%- set row_class = '' -%} |
| 238 | + {%- if 'btn-check' not in attr_class -%} |
| 239 | + {%- set attr_class = attr_class ~ ' form-check-input' -%} |
| 240 | + {%- set row_class = 'form-check' -%} |
| 241 | + {%- endif -%} |
| 242 | + {%- set attr = attr|merge({class: attr_class|trim}) -%} |
228 | 243 | {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
|
229 |
| - {%- set row_class = 'form-check' -%} |
230 | 244 | {%- if 'radio-inline' in parent_label_class -%}
|
231 | 245 | {%- set row_class = row_class ~ ' form-check-inline' -%}
|
232 | 246 | {%- endif -%}
|
233 |
| - <div class="{{ row_class }}"> |
234 |
| - {{- form_label(form, null, { widget: parent() }) -}} |
235 |
| - </div> |
| 247 | + {%- if row_class is not empty -%} |
| 248 | + <div class="{{ row_class }}"> |
| 249 | + {%- endif -%} |
| 250 | + {{- form_label(form, null, { widget: parent() }) -}} |
| 251 | + {%- if row_class is not empty -%} |
| 252 | + </div> |
| 253 | + {%- endif -%} |
236 | 254 | {%- endblock radio_widget %}
|
237 | 255 |
|
238 | 256 | {%- block choice_widget_collapsed -%}
|
|
276 | 294 | {%- block checkbox_radio_label -%}
|
277 | 295 | {#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
|
278 | 296 | {%- if widget is defined -%}
|
279 |
| - {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} |
| 297 | + {%- set label_attr_class = label_attr_class|default(label_attr.class|default('')) -%} |
| 298 | + {%- if 'btn' not in label_attr_class -%} |
| 299 | + {%- set label_attr_class = label_attr_class ~ ' form-check-label' -%} |
| 300 | + {%- endif -%} |
| 301 | + {%- set label_attr = label_attr|merge({class: label_attr_class|trim}) -%} | <
629A
/tr>
280 | 302 | {%- if not compound -%}
|
281 | 303 | {% set label_attr = label_attr|merge({'for': id}) %}
|
282 | 304 | {%- endif -%}
|
|
0 commit comments