FIX Support blacklist for SS 4.0 and 4.1, remove old Translatable reference in test class

This commit is contained in:
Robbie Averill 2018-03-15 17:15:19 +13:00
parent 6feec1de34
commit 30454dc04f
2 changed files with 6 additions and 6 deletions

View File

@ -487,9 +487,13 @@ class SiteTreeSubsites extends DataExtension
// Typically called on a singleton, so we're not using the Subsite() relation
$subsite = Subsite::currentSubsite();
if ($subsite && $subsite->exists() && $subsite->PageTypeBlacklist) {
$blacklist = Convert::json2array($subsite->PageTypeBlacklist) ?: [];
// SS 4.1: JSON encoded. SS 4.0, comma delimited
$blacklist = Convert::json2array($subsite->PageTypeBlacklist);
if ($blacklist === false) {
$blacklist = explode(',', $subsite->PageTypeBlacklist);
}
if (in_array(get_class($this->owner), $blacklist)) {
if (in_array(get_class($this->owner), (array) $blacklist)) {
return false;
}
}

View File

@ -21,10 +21,6 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
'SubsitesVirtualPageTest.yml',
];
protected static $illegal_extensions = [
SiteTree::class => ['Translatable'] // @todo implement Translatable namespace
];
protected function setUp()
{
parent::setUp();