Merge two or more forms into one

10 days ago

iwory
Member | 148
+
0
-

Hello, is there some way how to merge forms?

I have four separate forms for the edit but in one case I need to merge them into one. Is it possible to do that?

class OneForm extends Form
{

    public function __construct()
    {
        // Big logic of form here
        $this->addText('foo', 'Foo');
    }
}
class SecondForm extends Form
{

    public function __construct()
    {
        // Big logic of form here
        $this->addText('foo2', 'Foo2');
    }
}
....
class MyForm extends UI/Control
{

    public function createComponentForm()
    {
        $form = new UI/Form();
        $oneForm = new OneForm();
        $secondForm = new SecondForm();

        $form->someFunctionOrAnythingElse($oneForm);
        $form->someFunctionOrAnythingElse($secondForm);

        ...
    }
}