Closed
Description
Symfony version(s) affected
4.4.38
Description
Since this PR has been merged, the radio-inline
bootstrap class cannot be properly applied to radio input labels on expended ChoiceType
/ EntityType
when using Bootstrap 3 layout.
The issue is caused by this part of code removed from bootstrap_3_layout.html.twig
{%- if parent_label_class is defined -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) -%}
{%- endif -%}
The radio-inline class is handled here:
The same issue probably occurs on other bootstrap versions since other layouts were modified too.
How to reproduce
twig:
form_themes:
- 'bootstrap_3_layout.html.twig'
->add('template', EntityType::class, [
'class' => Template::class,
'choice_label' => 'name',
'expanded' => true,
])
{{ form_widget(form.template, {'label_attr': {'class': 'radio-inline'}}) }}
Result:
<label for="..." class="required"><input...></label>
<label for="..." class="required"><input...></label>
...
Before:
<label for="..." class="required radio-inline"><input...></label>
<label for="..." class="required radio-inline"><input...></label>
...