Hey guys,
I have a DataObject :-
class PanelContent extends DataObject
{
public static $TopID = 1;
static $db = array(
'Title' => 'Varchar',
'Group' => 'Varchar',
'Content' => 'HTMLText'
);
static $has_one = array(
'Image' => 'Image',
'Page' => 'Page'
);
function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push( new TextField( 'Title' ) );
$fields->push( new TextField( 'Group' ) );
$fields->push( new SimpleHTMLEditorField( 'Content' ) );
$fields->push( new ImageField( 'Image', 'Header Image', null, null, null, 'Uploads' ) );
return $fields;
}
}
This object acts as a panel in a given template
My page object then links them like this :-
public static $has_many = array(
"PanelItems" => "PanelContent"
);
This works great for one page, but the problem is, if I create more instances of this page, they "share" those objects. I need the objects to be bespoke for each page. How can I do this?
Thanks loads,
Lee