mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
fixing code analysis: simplify if-return statements
This commit is contained in:
parent
fea1684f5c
commit
9673c881c1
@ -176,15 +176,10 @@ class LeftAndMainSubsites extends Extension
|
|||||||
return true;
|
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,
|
// 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.
|
// which in turn uses the Permission API which is augmented by our GroupSubsites.
|
||||||
|
$controller = singleton($controllerName);
|
||||||
return false;
|
return $controller->hasMethod('subsiteCMSShowInMenu') && $controller->subsiteCMSShowInMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CanAddSubsites()
|
public function CanAddSubsites()
|
||||||
@ -227,12 +222,7 @@ class LeftAndMainSubsites extends Extension
|
|||||||
|
|
||||||
// Check if we have access to current section on the current subsite.
|
// Check if we have access to current section on the current subsite.
|
||||||
$accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
|
$accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
|
||||||
if ($accessibleSites->count() && $accessibleSites->find('ID', Subsite::currentSubsiteID())) {
|
return $accessibleSites->count() && $accessibleSites->find('ID', Subsite::currentSubsiteID());
|
||||||
// Current section can be accessed on the current site, all good.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,10 +45,7 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
|
|
||||||
public function isMainSite()
|
public function isMainSite()
|
||||||
{
|
{
|
||||||
if ($this->owner->SubsiteID == 0) {
|
return $this->owner->SubsiteID == 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user