Open richard-ejem opened 8 years ago
Why not make ControlGroup
implement IContainer
? It would also allow to have groups inside groups and get rid of the weird setCurrentGroup()
switching.
Isn’t the left one just more natural?
``` php $form = new UI\Form; $g1 = $form->addGroup('Group 1'); $g1->addText('foo', 'Foo'); $g2 = $form->addGroup('Group 2'); $g2->addText('bar', 'Bar'); ``` | ``` php $form = new UI\Form; $g1 = $form->addGroup('Group 1'); $form->setCurrentGroup($g1); $form->addText('foo', 'Foo'); $g2 = $form->addGroup('Group 2'); $form->setCurrentGroup($g2); $form->addText('bar', 'Bar'); ``` |
Common interface declaring
getControls()
would be useful for form renderers including DefaultFormRenderer.Example:
then, DefaultFormRenderer::renderControls() could look like:
If agreed, I can pullrequest it