Hello,
I also use bootstrap but i always use the $option array from $form->control to
add class based styling. I just override some (5!) standard form helper template stuff for layout ordering.
By the way: I agree with you statement about the documentation - especially the list of the template
standards is in the 4.x API Documentation missing. When I adjusted the form helper template a used cakephp 3.x
And in the 3.8. API documentation the list can be found here: Class Cake\View\Helper\FormHelper | CakePHP 3.8
And this works in 4.x as well…my App is on 4.2 now.
As I understand how CakePHP works in case of your observed behavior is the following:
All additional attributes of a tag from the $option array is added into the template placeholder {{attrs}}
In your case the [‘class’=>‘something’].
So I guess - If you look into your generated code you will finde the “class”-attribute twice in the tag:
And this is not HTML standard. At the moment I do not know how browser handle that, or how the HTML standard says.
But this could be the problem.
My advice: Do not change the the form helper template (for that). You can create view elements (Views - 4.x)
for your input tags if you do not want to add the bootstrap classes again and again in the view templates.
Or look at this plugin: GitHub - FriendsOfCake/bootstrap-ui: CakePHP: Transparently use Bootstrap found here: GitHub - FriendsOfCake/awesome-cakephp: A curated list of amazingly awesome CakePHP plugins, resources and shiny things.