8000 Bootstrap `radio-inline` no more working on expended choice types · Issue #45727 · symfony/symfony · GitHub
[go: up one dir, main page]

8000
Skip to content
Bootstrap radio-inline no more working on expended choice types #45727
Closed
@Seb33300

Description

@Seb33300

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:

{%- if 'radio-inline' in parent_label_class -%}

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>
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0