Hello,
I run into a problem and I have no idea hat the cause can be. Can anyone point me in the right direction?
Any help is very much appreciated!
This is the error I get:
Call to a member function FormAction() on a non-objectin /home/sites/development/000_SILVERSTRIPE/www/3_1_8/framework/forms/FormField.php on line 157, referer: http://www.bestmeat4u.hst3.nl/admin/bm-settings/
This is the code:
First SettingsAdmin.php
class SettingsAdmin extends LeftAndMain {
private static $model_importers = array();
static $url_segment = 'bm-settings';
static $menu_title = 'BM Instellingen';
static $menu_icon = 'bm-settings/images/icons/flexslider_icon.png';
function getEditForm() {
$fields = new FieldList(
new TabSet(
$name = "Root",
new Tab(
$title='Verkoop',
new TabSet(
$name='Verkoop',
new Tab(
$title='Verkoopitems'
)
)
)
)
);
$conf=GridFieldConfig_RecordEditor::create(10);
$emaildefault = DataObject::get('EmailDefault', '', 'SortOrder ASC');
$grid= new GridField('EmailContent', 'EmailContent', $emaildefault, $conf);
$fields->addFieldToTab('Root.Verkoop.Verkoop.Verkoopitems', $grid);
return $fields;
}
}
And EmailDeafult.php:
<?php
class EmailDefault extends DataObject {
private static $db = array(
'Name' => 'Varchar',
'Description' => 'Varchar',
'SortOrder' => 'Int'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
It goes wrong in this line:
$fields->addFieldToTab('Root.Verkoop.Verkoop.Verkoopitems', $grid);
When I replace this line with this I don't get thet error and the headerfield is added to the tab.
$fields->addFieldToTab('Root.Verkoop.Verkoop.Verkoopitems', new HeaderField('Article categories', 2));
So my conclusion, it goes wrong at the moment the grid is added to the tab but why? Creating the grid doesn't give an error.