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

Using class attribute in TextInput's render method limits adding more classes #11

Open
mysutka opened this issue Aug 23, 2017 · 1 comment

Comments

@mysutka
Copy link
Contributor

mysutka commented Aug 23, 2017

I would like to be able add more classes to the default 'text form-control'.

Now the input renders with these default classes when i don't specify them in constructor.

...
"widget" => new TextInput()
...

When any class is specified in constructor option attr these default do not render

...
"widget" => new TextInput(array(
  "attrs" => array("class" => "any-class"),
))
...

This renders input with class="any-class" but it should preserve the default classes and render the input with class="any-class text form-control"

@yarri
Copy link
Contributor

yarri commented May 10, 2019

I don't think that preserve default classes is a good idea. There must be a way to set completely different classes. So you should use

...
"widget" => new TextInput(array(
  "attrs" => array("class" => "any-class text form-control"),
))
...

Does it sound good to you?

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