Merge pull request #1704 from mikenz/page-to-sitetree

ENHANCEMENT: Use SiteTree instead of Page class in more places.
This commit is contained in:
Daniel Hensby 2017-01-03 10:43:56 +00:00 committed by GitHub
commit f669c6a0b7
2 changed files with 3 additions and 5 deletions

View File

@ -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;

3
code/Controllers/ContentController.php Executable file → Normal file
View File

@ -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();
}