diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index d47836b8..7c0d769b 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -176,15 +176,10 @@ public function alternateMenuDisplayCheck($controllerName) return true; } - $controller = singleton($controllerName); - if ($controller->hasMethod('subsiteCMSShowInMenu') && $controller->subsiteCMSShowInMenu()) { - return true; - } - // It's not necessary to check access permissions here. Framework calls canView on the controller, // which in turn uses the Permission API which is augmented by our GroupSubsites. - - return false; + $controller = singleton($controllerName); + return $controller->hasMethod('subsiteCMSShowInMenu') && $controller->subsiteCMSShowInMenu(); } public function CanAddSubsites() @@ -227,12 +222,7 @@ public function canAccess() // Check if we have access to current section on the current subsite. $accessibleSites = $this->owner->sectionSites(true, 'Main site', $member); - if ($accessibleSites->count() && $accessibleSites->find('ID', Subsite::currentSubsiteID())) { - // Current section can be accessed on the current site, all good. - return true; - } - - return false; + return $accessibleSites->count() && $accessibleSites->find('ID', Subsite::currentSubsiteID()); } /** diff --git a/code/extensions/SiteTreeSubsites.php b/code/extensions/SiteTreeSubsites.php index 6028dc6a..4d65ec44 100644 --- a/code/extensions/SiteTreeSubsites.php +++ b/code/extensions/SiteTreeSubsites.php @@ -45,10 +45,7 @@ class SiteTreeSubsites extends DataExtension public function isMainSite() { - if ($this->owner->SubsiteID == 0) { - return true; - } - return false; + return $this->owner->SubsiteID == 0; } /**