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
|
* @package subsites
|
||||||
*/
|
*/
|
||||||
class FileSubsites extends DataObjectDecorator {
|
class FileSubsites extends DataObjectDecorator {
|
||||||
|
|
||||||
function extraStatics() {
|
function extraStatics() {
|
||||||
// This is hard-coded to be applied to SiteTree, unfortunately
|
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
|
||||||
if($this->owner->class == 'File') {
|
if($this->owner->class != 'File') return null;
|
||||||
return array(
|
|
||||||
'has_one' => array(
|
|
||||||
'Subsite' => 'Subsite',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
return array(
|
||||||
|
'has_one' => array(
|
||||||
|
'Subsite' => 'Subsite',
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
class GroupSubsites extends DataObjectDecorator {
|
class GroupSubsites extends DataObjectDecorator {
|
||||||
|
|
||||||
function extraStatics() {
|
function extraStatics() {
|
||||||
// This is hard-coded to be applied to SiteTree, unfortunately
|
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
|
||||||
if($this->owner->class == 'Group') {
|
if($this->owner->class != 'Group') return null;
|
||||||
return array(
|
|
||||||
'has_one' => array(
|
|
||||||
'Subsite' => 'Subsite',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
return array(
|
||||||
|
'has_one' => array(
|
||||||
|
'Subsite' => 'Subsite',
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCMSFields(&$fields) {
|
function updateCMSFields(&$fields) {
|
||||||
|
@ -28,15 +28,15 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
|||||||
|
|
||||||
|
|
||||||
function extraStatics() {
|
function extraStatics() {
|
||||||
// This is hard-coded to be applied to SiteTree, unfortunately
|
if(!method_exists('DataObjectDecorator', 'load_extra_statics')) {
|
||||||
if($this->owner->class == 'SiteTree') {
|
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
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
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