FIX Use correct subsites namespace in SiteTree and test classes

This commit is contained in:
Robbie Averill 2018-09-27 14:07:42 +02:00
parent d748566054
commit ce3a1ce913
2 changed files with 11 additions and 11 deletions

View File

@ -63,6 +63,7 @@ use SilverStripe\Security\PermissionChecker;
use SilverStripe\Security\PermissionProvider;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Subsites\Model\Subsite;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\ArrayData;
@ -70,7 +71,6 @@ use SilverStripe\View\HTML;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\View\SSViewer;
use Subsite;
/**
* Basic data-object representing all pages within the site tree. All page types that live within the hierarchy should
@ -1740,7 +1740,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
*/
public function DependentPages($includeVirtuals = true)
{
if (class_exists('Subsite')) {
if (class_exists(Subsite::class)) {
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
}
@ -1785,7 +1785,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
$items->merge($redirectorList);
}
if (class_exists('Subsite')) {
if (class_exists(Subsite::class)) {
Subsite::disable_subsite_filter($origDisableSubsiteFilter);
}
@ -1804,9 +1804,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
// Disable subsite filter for these pages
if ($pages instanceof DataList) {
return $pages->setDataQueryParam('Subsite.filter', false);
} else {
return $pages;
}
return $pages;
}
/**
@ -1875,8 +1874,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
'AbsoluteLink' => _t(__CLASS__.'.DependtPageColumnURL', 'URL'),
'DependentLinkType' => _t(__CLASS__.'.DependtPageColumnLinkType', 'Link type'),
);
if (class_exists('Subsite')) {
$dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name();
if (class_exists(Subsite::class)) {
$dependentColumns['Subsite.Title'] = Subsite::singleton()->i18n_singular_name();
}
$dependentNote = new LiteralField('DependentNote', '<p>' . _t(__CLASS__.'.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>');

View File

@ -10,6 +10,7 @@ use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Subsites\Extensions\SiteTreeSubsites;
use SilverStripe\Versioned\Versioned;
/**
@ -20,11 +21,11 @@ class SiteTreePermissionsTest extends FunctionalTest
{
protected static $fixture_file = "SiteTreePermissionsTest.yml";
protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites')
);
protected static $illegal_extensions = [
SiteTree::class => [SiteTreeSubsites::class],
];
public function setUp()
protected function setUp()
{
parent::setUp();