diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index e36bea5..de5fc2b 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -273,8 +273,10 @@ class SiteTreeSubsites extends DataExtension * - Is in a group which has access to the subsite this page belongs to * - Is in a group with edit permissions on the "main site" * - * @param null $member - * @return bool + * If there are no subsites configured yet, this logic is skipped. + * + * @param Member|null $member + * @return bool|null */ public function canEdit($member = null) { @@ -282,6 +284,11 @@ class SiteTreeSubsites extends DataExtension $member = Security::getCurrentUser(); } + // Do not provide any input if there are no subsites configured + if (!Subsite::get()->count()) { + return null; + } + // Find the sites that this user has access to $goodSites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true, 'all', $member)->column('ID'); @@ -329,8 +336,8 @@ class SiteTreeSubsites extends DataExtension } /** - * @param null $member - * @return bool + * @param Member|null $member + * @return bool|null */ public function canPublish($member = null) {