mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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.
This commit is contained in:
parent
caca15034b
commit
ffc6d6ffad
@ -212,8 +212,12 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
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 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
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 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
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 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user