EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
3.99k stars 1.01k forks source link

setHtmlAttributes methods doesn't create multiple attributs #6253

Open FabzAllotools opened 1 month ago

FabzAllotools commented 1 month ago

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 commented 1 week ago

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>