Hi All,
I'm trying to set up a page (much like a blog page) in which subsections appear on the page. And within those subsections, I'm trying to create sub-sub-sections using the ManyManyComplexTableField(). But I'm getting a "Cannot instantiate abstract class Object" error when I try to view the CMS. I'm using the many_many tutorial found here.
Example:
(ResourceHolder)
|
> (ResourceSection)
>> (ResourceModule)
>> (ResourceModule)
|
> (ResourceSection)
>> (ResourceModule)
>> (ResourceModule)
/mysite/code/ResourceHolder.php
<?php
class ResourceHolder extends Page {
static $allowed_children = array('ResourceSection');
static $db = array();
static $has_one = array();
// return cms fields
}
class ResourceHolder_Controller extends Page_Controller {
}
?>
/mysite/code/ResourceSection.php
<?php
class ResourceSection extends Page {
static $db = array();
static $has_one = array();
function getCMSFields() {
$fields = parent::getCMSFields();
$modulesTablefield = new ManyManyComplexTableField(
$this,
'ResourceSections',
'ResourceSection',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$modulesTablefield->setAddTitle( 'A Module' );
$fields->addFieldToTab( 'Root.Content.ResourceSections', $modulesTablefield );
return $fields;
}
}
?>
/mysite/code/ResourceModule.php
<?php
class ResourceModule extends DataObject {
static $db = array(
'Title' => 'Text',
'Copy' => 'Text',
'Link' => 'Text',
'LinkText' => 'Text'
);
static $belongs_many_many = array(
'ResourceSections' => 'ResourceSection'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Title'));
$fields->push(new TextField('Copy'));
$fields->push(new TextField('Link'));
$fields->push(new TextField('LinkText'));
return $fields;
}
}
?>
Any help is greatly appreciated. Thanks!
Chris.b