From a53008501665c875ff4d908b1d49e2fda22c11bb Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Sun, 8 Feb 2015 00:30:16 +0000 Subject: [PATCH] FIX External redirects shouldnt show in preview pane --- code/controllers/CMSMain.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index ebb326cd..701e3c93 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -227,13 +227,22 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $link; } - + /** * @return string */ public function LinkPreview() { $record = $this->getRecord($this->currentPageID()); - $baseLink = ($record && $record instanceof Page) ? $record->Link('?stage=Stage') : Director::absoluteBaseURL(); + $baseLink = Director::absoluteBaseURL(); + if ($record && $record instanceof Page) { + // if we are an external redirector don't show a link + if ($record instanceof RedirectorPage && $record->RedirectionType == 'External') { + $baseLink = false; + } + else { + $baseLink = $record->Link('?stage=Stage'); + } + } return $baseLink; }