Thursday, April 9, 2015

How to set class on form template node with {{attrs}} defined?

I have a question regarding this type of scenario regarding form templates.

Lets say I am trying to change the default class of label in the following example:

'nestingLabel' => '{{input}}<label{{attrs}}>{{text}}</label>',

Doing this wont work since the attrs might also have a class attribute that could cause a double class declaration:
<label class="some-class"{{attrs}}>{{text}}</label>

Where would be the correct place to define this default class?
Should I extend the widget and add it to the default options there or is there a better way to accomplish this?



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: