Skip to content

Conversation

@Vlczech
Copy link
Contributor

@Vlczech Vlczech commented Mar 26, 2017

If I use some classes on inputs, usage of:
{input some-input, class => 'some-class'}
leads to overwrite previously set classes.

However:
$form['some-input']->getControlPrototype()->addAttributes(['class' => 'some-class'])
leads to merge previously set classes with the other one classes.

@uestla
Copy link
Owner

uestla commented Mar 30, 2017

This doesn't work since it does the same thing as the native {input /} macro - see here.

->getPrototype()->addClass('form-control') however works...

@Vlczech
Copy link
Contributor Author

Vlczech commented Mar 30, 2017

That's strange... If i added some class to input and use yours {input forminput, class => 'form-control'}, class which i set was ignored. If I tried to use {$form['forminput']->getprototype()->addClass('form-control')} {$form['forminput']->getprototype()->addAttributes(['class' => 'form-control'])} immediately before your code (and delete , class => 'form-control' from this input), then the class was set in the final code. That's why I decided for this pull request.

When I have a moment, i will try once again.

@uestla
Copy link
Owner

uestla commented Mar 30, 2017

Yes that's correct, but in this pull request you're using addAttributes(), not addClass() :)

@Vlczech
Copy link
Contributor Author

Vlczech commented Mar 30, 2017

Sorry, that was a mistake, that i wrote another function thatn in pull request.

I used addAttributes as in pull request - editted previous message ;)

@uestla uestla force-pushed the master branch 3 times, most recently from 6b17985 to 97f4193 Compare October 11, 2019 10:32
@uestla uestla force-pushed the master branch 8 times, most recently from c4333ec to 003cc91 Compare April 3, 2021 17:25
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

Successfully merging this pull request may close these issues.

2 participants