mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2120 from open-sausages/pulls/4.0/fix-in-section
BUG Fix InSection failing on non-page controllers
This commit is contained in:
commit
a02410b983
@ -759,8 +759,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
public function InSection($sectionName)
|
public function InSection($sectionName)
|
||||||
{
|
{
|
||||||
$page = Director::get_current_page();
|
$page = Director::get_current_page();
|
||||||
while ($page && $page->exists()) {
|
while ($page instanceof SiteTree && $page->exists()) {
|
||||||
if ($sectionName == $page->URLSegment) {
|
if ($sectionName === $page->URLSegment) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$page = $page->Parent();
|
$page = $page->Parent();
|
||||||
|
Loading…
Reference in New Issue
Block a user