Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap radio-inline no more working on expended choice types #45727

Closed
Seb33300 opened this issue Mar 13, 2022 · 9 comments
Closed

Bootstrap radio-inline no more working on expended choice types #45727

Seb33300 opened this issue Mar 13, 2022 · 9 comments

Comments

@Seb33300
Copy link
Contributor

Seb33300 commented Mar 13, 2022

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>
...
@Seb33300
Copy link
Contributor Author

Seb33300 commented Mar 13, 2022

Just found a similar issue: #44332

@xabbuh
Copy link
Member

xabbuh commented Mar 13, 2022

Can you create a small example application that allows to reproduce your issue?

@xabbuh
Copy link
Member

xabbuh commented Mar 25, 2022

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this as completed Mar 25, 2022
@dragu
Copy link

dragu commented Apr 11, 2022

Same here on Symfony 5.4.7

@BangouraAlseny
Copy link

Can you create a small example application that allows to reproduce your issue?

Hello @xabbuh ,
I got the same issue. So, I did a small example project to reproduce it as you asked.

https://github.com/BangouraAlseny/symfony_issue_45727

Bug result
bug

Excepted result
expectedResult

@Seb33300
Copy link
Contributor Author

Seb33300 commented Jun 8, 2022

This issue could be fixed by #18318

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3

@xabbuh
Copy link
Member

xabbuh commented Feb 17, 2023

see #49421

@carsonbot carsonbot removed the Stalled label Feb 17, 2023
nicolas-grekas added a commit that referenced this issue Feb 21, 2023
This PR was merged into the 5.4 branch.

Discussion
----------

[TwigBridge] do not drop embed label classes

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #45727
| License       | MIT
| Doc PR        |

Commits
-------

cd50683 do not drop embed label classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants