bug #26254 fix custom radios/inputs for checkbox/radio type (mssimi)

This PR was merged into the 3.4 branch.

Discussion
----------

fix custom radios/inputs for checkbox/radio type

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   |
| Fixed tickets | #25715
| License       | MIT
| Doc PR        |

Hey, I tried new changes in bootstrap 4 layout. Unfortunatelly custom-radios/checkboxes seems to work only for ChoiceType/EntityType but not for CheckboxType/RadioType. I added changes which I belive fix this issue.

Commits
-------

dd6d1dd119 fix custom radios/inputs for checkbox/radio type
This commit is contained in:
Fabien Potencier 2018-02-21 14:07:14 +01:00
commit 743129f3e2

View File

@ -190,7 +190,9 @@
{% block checkbox_radio_label -%}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{%- if widget is defined -%}
{%- if parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) -%}
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %}
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %}
{%- if is_parent_custom or is_custom -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
{%- else %}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}