mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX Made GroupSubsites, FileSubsites and SiteTreeSubsites work properly if DataObjectDecorator::load_extra_statics() is defined
This commit is contained in:
parent
2916b29287
commit
6e1499822f
@ -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',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user