From 2108d8ef082d2c5fda90d6d9bd85b02adb17a345 Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Tue, 3 Jan 2017 20:38:45 +1300 Subject: [PATCH] Use SiteTree instead of Page class in more places. Allows developers to extend SiteTree directly. --- code/Controllers/CMSMain.php | 3 +-- code/Controllers/ContentController.php | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 100755 => 100644 code/Controllers/ContentController.php diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index dd8ef252..70c1db58 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -59,7 +59,6 @@ use SilverStripe\Security\SecurityToken; use SilverStripe\View\ArrayData; use SilverStripe\View\Requirements; use Translatable; -use Page; use Zend_Cache; use InvalidArgumentException; @@ -352,7 +351,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr public function LinkPreview() { $record = $this->getRecord($this->currentPageID()); $baseLink = Director::absoluteBaseURL(); - if ($record && $record instanceof Page) { + if ($record && $record instanceof SiteTree) { // if we are an external redirector don't show a link if ($record instanceof RedirectorPage && $record->RedirectionType == 'External') { $baseLink = false; diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php old mode 100755 new mode 100644 index 52ec2c17..0f348203 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -28,7 +28,6 @@ use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\View\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; -use Page; use Translatable; /** @@ -67,7 +66,7 @@ class ContentController extends Controller { */ public function __construct($dataRecord = null) { if(!$dataRecord) { - $dataRecord = new Page(); + $dataRecord = new SiteTree(); if($this->hasMethod("Title")) { $dataRecord->Title = $this->Title(); } @@ -277,7 +276,7 @@ class ContentController extends Controller { // Remove all entries the can not be viewed by the current user // We might need to create a show in menu permission - if(isset($result)) { + if(isset($result)) { foreach($result as $page) { if($page->canView()) { $visible[] = $page;