$form = new Form();
return $form->addHiddenElement('somename', 'value')
->addTextInputElement('someothername', 'value')
->generate();
We have a simple form generator that works a little like above.
Is it possible to get this done with a config, eg a simple php array?
I know about: http://php.net/manual/en/function.call-user-func-array.php and other similar functions. But in the above we have an unknown qty of functions each with an unknown qty of params and each must chain onto the next...
For this array could potentially map correctly..
return [
'addHiddenElement' => [
'somename', 'value'
],
'addTextInputElement' => [
'someothername', 'value'
]
]
Is this possible in php?
(in javascript this could be done with evil eval ;) but i get the idea there might be a proper way to do this in php)