Hi,
I suspect I am approaching this wrongly. I've created two DataObject files, one for the left column images in my template and the other for right column, which are editable by "Left" and "Right" tabs in the CMS.
The other data object file is the same but defines the class ImageLeft.
<?php
class ImageRight extends DataObject
{
static $db = array (
'CaptionRight' => 'Varchar(50)'
);
static $has_one = array (
'Page' => 'Page',
'ImageRight' => 'Image'
);
function getCMSFields()
{
return new FieldSet(
new ImageField('ImageRight'),
new TextField('CaptionRight','Caption')
);
}
}
?>
The relevant code from Page.php looks like:
static $has_many = array (
'ImagesLeft' => 'ImageLeft',
'ImagesRight' => 'ImageRight'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Left", new ImageDataObjectManager($this));
$fields->addFieldToTab("Root.Content.Right", new ImageDataObjectManager($this));
return $fields;
It works fine if I just use the intelligent constructor once (e.g., Left tab). But when I add the second for the right column it just pulls the ImageLeft data object variables.
Thanks for the help,
Sam