Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX Disable CMS preview for RedirectorPage (fixes #7127)

If the redirect is to an internal page, the preview iframe
will automatically load this new URL, causing the CMS edit
form to switch as well - effectively making it impossible
to edit a redirector page in the CMS as soon as it is saved
with an internal redirection target.
  • Loading branch information...
commit ffc6d6ffad18e61c27b3a1b3899b1f4380fd72ea 1 parent caca150
@chillu chillu authored
Showing with 24 additions and 5 deletions.
  1. +24 −5 code/controllers/SilverStripeNavigator.php
View
29 code/controllers/SilverStripeNavigator.php
@@ -212,8 +212,12 @@ public function isActive() {
}
public function canView($member = null) {
- // Don't show in CMS
- return !(Controller::curr() instanceof CMSMain);
+ return (
+ // Don't show in CMS
+ !(Controller::curr() instanceof CMSMain)
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
}
@@ -246,7 +250,12 @@ public function getLink() {
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->getDraftPage()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
@@ -294,7 +303,12 @@ public function getLink() {
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->getLivePage());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->getLivePage()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
@@ -340,7 +354,12 @@ public function getLink() {
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->isArchived());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->isArchived()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
Please sign in to comment.
Something went wrong with that request. Please try again.