10377 Posts in 2193 Topics by 1709 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 161 Views |
-
Subsites module. SiteConfig extension hasmany issue

6 July 2012 at 1:17pm Last edited: 6 July 2012 1:35pm
I'm having an issue with the subsites module:
In my site, I am extending SiteConfig to add a number of site-wide options. I am able to set all of these on a persite basis with the exception of the BackgroundImages dataobjectmanager. For some reason, every background I add to each site is added to all the other sites as well. Not just the active one. Is there anything I am doing wrong in my code:
<?php
class SiteConfigExtension extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'FooterContent' => 'HTMLText',
'PrimaryColour' => 'Varchar',
'SecondaryColour' => 'Varchar',
'Identifier' => 'Varchar'
),
'has_one' => array(
'Logo' => 'Photo',
'HeaderPhoto' => 'Photo',
'DefaultBG' => 'Photo',
'ToggleTab' => 'Photo'
),
'has_many' => array(
'BackgroundImages' => 'BackgroundImage'
)
);
}
static $default_child = "Gallery";
function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab('Root.Footer', new HTMLEditorField('FooterContent', 'Footer Content'));
$fields->addFieldToTab('Root.DefaultBackground', new ImageUploadField('DefaultBG', 'DefaultBG'));
$fields->addFieldToTab('Root.Backgrounds', new ImageDataObjectManager($this->owner, 'BackgroundImages', 'BackgroundImage'));
$fields->addFieldToTab('Root.Styling', new TextField('PrimaryColour', 'Primary Colour'));
$fields->addFieldToTab('Root.Styling', new TextField('SecondaryColour', 'Secondary Colour'));
$fields->addFieldToTab('Root.Styling', new ImageField('ToggleTab', 'Toggle Tab'));
$fields->addFieldToTab('Root.Styling', new TextField('Identifier', 'Identifier'));
$fields->addFieldToTab('Root.Main', new ImageField('Logo', 'Logo'));
$fields->removeByName('Tagline');
$fields->removeByName('Theme');
}
}Update: I am getting the expected result in the front end of the site (the site they were added from in subsites is displaying the correct background images ), however it is just in the imagedataobjectmanager in the CMS where it is displaying them all together.
Here is the code for the BackgroundImage class:
<?php
class BackgroundImage extends Photo {
static $has_one = array(
'SiteConfig' => 'SiteConfig'
);}
| 161 Views | ||
|
Page:
1
|
Go to Top |

