From d66a47271d945f8675ae76c407c05341bf4e843f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 29 Oct 2011 19:13:19 +0200 Subject: [PATCH] MINOR Implemented CMSMain->PreviewLink() (moved from LeftAndMain) --- code/controllers/CMSMain.php | 9 +++++++++ code/controllers/CMSPagesController.php | 4 ++++ code/controllers/CMSSettingsController.php | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 1eb09da8..54ca14a9 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -125,6 +125,15 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr "$action" ); } + + /** + * @return string + */ + public function PreviewLink() { + $record = $this->getRecord($this->currentPageID()); + $baseLink = ($record && $record instanceof Page) ? $record->Link('?stage=Stage') : Director::absoluteBaseURL(); + return $baseLink; + } /** * Return the entire site tree as a nested set of ULs diff --git a/code/controllers/CMSPagesController.php b/code/controllers/CMSPagesController.php index 8370d3a9..54bb2e0c 100644 --- a/code/controllers/CMSPagesController.php +++ b/code/controllers/CMSPagesController.php @@ -34,4 +34,8 @@ class CMSPagesController extends CMSMain { return parent::Link($action); } + function PreviewLink() { + return false; + } + } \ No newline at end of file diff --git a/code/controllers/CMSSettingsController.php b/code/controllers/CMSSettingsController.php index 93bcac8f..ffd6145e 100644 --- a/code/controllers/CMSSettingsController.php +++ b/code/controllers/CMSSettingsController.php @@ -10,4 +10,8 @@ class CMSSettingsController extends CMSMain { return $this->RootForm(); } + function PreviewLink() { + return false; + } + } \ No newline at end of file