diff --git a/.upgrade.yml b/.upgrade.yml index 0bfa949b..d59203ba 100644 --- a/.upgrade.yml +++ b/.upgrade.yml @@ -150,9 +150,12 @@ excludedPaths: - '*/_config/legacy.yml' warnings: methods: - 'SilverStripe\CMS\Model\SiteTree::getIsAddedToStage()': + 'SilverStripe\CMS\Model\SiteTree->getIsAddedToStage()': message: 'Moved to Versioned->isOnDraftOnly()' - 'SilverStripe\CMS\Model\SiteTree::getIsModifiedOnStage()': + replacement: 'isOnDraftOnly' + 'SilverStripe\CMS\Model\SiteTree->getIsModifiedOnStage()': message: 'Moved to Versioned->isModifiedOnDraft()' - 'SilverStripe\CMS\Model\SiteTree::getExistsOnLive()': + replacement: 'isModifiedOnDraft' + 'SilverStripe\CMS\Model\SiteTree->getExistsOnLive()': message: 'Removed in favour of isPublished()' + replacement: 'isPublished' diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 82b8f595..a3815a8a 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -773,8 +773,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi public function InSection($sectionName) { $page = Director::get_current_page(); - while ($page && $page->exists()) { - if ($sectionName == $page->URLSegment) { + while ($page instanceof SiteTree && $page->exists()) { + if ($sectionName === $page->URLSegment) { return true; } $page = $page->Parent(); diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 7b70f49e..e4acf2ff 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -12,7 +12,6 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ValidationResult; use SilverStripe\Security\Member; use SilverStripe\Versioned\Versioned; -use SilverStripe\View\SSViewer; /** * Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly. @@ -366,7 +365,11 @@ class VirtualPage extends Page public function CMSTreeClasses() { - return parent::CMSTreeClasses() . ' VirtualPage-' . $this->CopyContentFrom()->ClassName; + $parentClass = sprintf( + ' VirtualPage-%s', + Convert::raw2htmlid($this->CopyContentFrom()->ClassName) + ); + return parent::CMSTreeClasses() . $parentClass; } /**