diff --git a/code/FileSubsites.php b/code/FileSubsites.php index 3087685..54da090 100755 --- a/code/FileSubsites.php +++ b/code/FileSubsites.php @@ -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', + ), + ); } /** diff --git a/code/GroupSubsites.php b/code/GroupSubsites.php index bb03146..5503dc3 100644 --- a/code/GroupSubsites.php +++ b/code/GroupSubsites.php @@ -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) { diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index be72efc..7ef36cb 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -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 + ) + ); } /**