1
Let's say we have two class to define form elements (for example, the module mytabs):
class MytabspageForm extends XoopsThemeForm {
function createElements($target) {
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'pagetitle', 35, 255, $target->getVar('pagetitle', 'e')));
[...]
}
}
class MytabsTabForm extends XoopsThemeForm {
function createElements($target) {
$this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'tabtitle', 35, 255, $target->getVar('tabtitle', 'e')));
$this->addElement(new XoopsFormDateTime(_AM_MYTABS_PUBLISHDATE, 'tabfromdate', 15, $target->getVar('tabfromdate', 'e')));
[...]
}
}
Is it possible to incorporate elements of the form in one class to another?
For example...
$form = new MytabsTabForm;
$form->createElements();
echo $form->render();
could show TabForm with elements from PageForm (between 'tabtitle' and 'tabfromdate').
You know... If you want to change the items in PageForm you need to modify this one class rather than two.
It does not concern me about this particular module, but the overall concept. How to solve for classes?