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

setHtmlAttributes methods doesn't create multiple attributs #6253

Open
FabzAllotools opened this issue Apr 10, 2024 · 1 comment
Open

setHtmlAttributes methods doesn't create multiple attributs #6253

FabzAllotools opened this issue Apr 10, 2024 · 1 comment

Comments

@FabzAllotools
Copy link

I need to get 2 HTML attributs on a form tab by using setHtmlAttributes on FormField::addTab. Instead of getting 2 attributs I get only one containing as value all the rest of the array.

ex : ->setHtmlAttributes(['data-foo' => 'bar', 'autofocus' => 'autofocus']) should get <... data-foo=bar autofocus=autofocus> but I get <... data-foo="barautofocus=autofocus" instead>

@d3pendent
Copy link

d3pendent commented May 6, 2024

same issue here.

A really hacky workaround is:

->setHtmlAttributes(['data-controller=foo data-foo-mycustom-value=myCustomValue data-ignore' => ''])
That will result in the first two attributes being added correctly, and the data-ignore is just for dealing with the set value.

<div data-controller="foo" data-foo-mycustom-value="myCustomValue" data-ignore></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants