Hi,
I want to use the functionality of the form module inside my module. The problem is that i can not extend the class tl_form as my forms need to be attached to an other element.
I tried to adapt the DCA from tl_form with array_insert. This is working but the original tl_form is then not working anymore as it is outputting an error that it can not find tl_ff_tasks when using the form module
This is the reason why I did the following:
Code:
$this->loadLanguageFile('tl_form');
include(TL_ROOT.'/system/modules/backend/dca/tl_form.php');
$GLOBALS['TL_DCA']['tl_ff_form']=$GLOBALS['TL_DCA']['tl_form'];
array_insert($GLOBALS['TL_DCA']['tl_ff_form']['config']['ptable'], 1, 'tl_ff_tasks'); <== other element
array_insert($GLOBALS['TL_DCA']['tl_ff_form']['config']['ctable'], 1, array('tl_ff_form_field')
);
...... Some extra fields
class tl_ff_form extends Backend
{
/**
* Import the back end user object
*/
public function __construct()
{
parent::__construct();
$this->import('BackendUser', 'User');
}
public function deleteFormButton($row, $href, $label, $title, $icon, $attributes)
{
return ($this->User->isAdmin || $this->User->hasAccess('delete', 'flexiform')) ? ''.$this->generateImage($icon, $label).' ' : $this->generateImage(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
}
}
Is this the correct way?
+
I have the following issue: When i try to delete a tl_ff_form I get the following error:
Fatal error: Cannot redeclare class tl_form_field in /Users/freeyland/Sites/bureauguide/system/modules/backend/dca/tl_form_field.php on line 627
Why does it keep referencing to tl_form_field?
Bookmarks