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

v3 Form Group actions classes #97

Open
e-belair opened this issue Jan 21, 2014 · 5 comments
Open

v3 Form Group actions classes #97

e-belair opened this issue Jan 21, 2014 · 5 comments

Comments

@e-belair
Copy link
Contributor

@RWOverdijk i need your help
Could you help me to implement properly this:
https://github.com/SpoonX/SxBootstrap/blob/3.0.0/src/SxBootstrap/View/Helper/Bootstrap/Form/Row.php#L79

User could set the action class, but i don't know how
we could add a property that by default has the value "col-sm-offset-2 col-sm-8" that is sufficient for the genral use.
But we have to let user change this property.

@RWOverdijk
Copy link
Member

Assuming that this code works, I'd turn it into this:

$rowPlugin->getElement()->spawnChild()->addClass('col-sm-offset-2 col-sm-8')->setContent($content);

@e-belair
Copy link
Contributor Author

But how to let user custom the classes?
EG:

$rowPlugin->getElement()->spawnChild()->addClass($userCustomClass)->setContent($content);

@RWOverdijk
Copy link
Member

You wouldn't. I think I've told you this before but... This file is a convenience file. It makes rendering a row easier. You're returning the object so you could have them, or us, set it afterwards, like:

// In Row.php
$rowPlugin->getElement()->spawnChild()->addClass('col-sm-offset-2 col-sm-8')->setContent($content);

// In wherever you're using Row
$rowPlugin = $rowHelper->renderActionsRow($actions);
$rowPlugin->getChildren()[0]->addClass('my awesome classes');

Otherwise just allow them to supply classes with the second argument.

@e-belair
Copy link
Contributor Author

From the Row ok, but from the form Helper?

echo $this->sxbForm($form, true)->horizontal(); // How to set the action class and automatically render the form?

@RWOverdijk
Copy link
Member

Then you shouldn't use the Form helper. If you want to do custom stuff, you have to write custom code. We can't make everyone happy with extremely specific implementations I'm afraid. The best I can come up with is adding another method to Form, so you can chain. Examples:

echo $this->sxbForm($form, true)->horizontal()->setActionElementClass('my cool classes');
echo $this->sxbForm($form, true)->horizontal()->getActionElement()->getChildren()[0]->addClass('my cool classes');

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