BUGFIX Made GroupSubsites, FileSubsites and SiteTreeSubsites work properly if DataObjectDecorator::load_extra_statics() is defined

This commit is contained in:
Sean Harvey 2009-06-22 12:03:04 +00:00
parent 2916b29287
commit 6e1499822f
3 changed files with 23 additions and 22 deletions

View File

@ -5,15 +5,16 @@
* @package subsites
*/
class FileSubsites extends DataObjectDecorator {
function extraStatics() {
// This is hard-coded to be applied to SiteTree, unfortunately
if($this->owner->class == 'File') {
return array(
'has_one' => array(
'Subsite' => 'Subsite',
),
);
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
if($this->owner->class != 'File') return null;
}
return array(
'has_one' => array(
'Subsite' => 'Subsite',
),
);
}
/**

View File

@ -7,14 +7,14 @@
class GroupSubsites extends DataObjectDecorator {
function extraStatics() {
// This is hard-coded to be applied to SiteTree, unfortunately
if($this->owner->class == 'Group') {
return array(
'has_one' => array(
'Subsite' => 'Subsite',
),
);
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
if($this->owner->class != 'Group') return null;
}
return array(
'has_one' => array(
'Subsite' => 'Subsite',
),
);
}
function updateCMSFields(&$fields) {

View File

@ -28,15 +28,15 @@ class SiteTreeSubsites extends DataObjectDecorator {
function extraStatics() {
// This is hard-coded to be applied to SiteTree, unfortunately
if($this->owner->class == 'SiteTree') {
return array(
'has_one' => array(
'Subsite' => 'Subsite', // The subsite that this page belongs to
'MasterPage' => 'SiteTree', // Optional; the page that is the content master
),
);
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
if($this->owner->class != 'SiteTree') return null;
}
return array(
'has_one' => array(
'Subsite' => 'Subsite', // The subsite that this page belongs to
'MasterPage' => 'SiteTree', // Optional; the page that is the content master
)
);
}
/**