From 1d944025176cdb4b135a9631dbd5016da9491ec5 Mon Sep 17 00:00:00 2001 From: Nathan Glasl Date: Tue, 28 Mar 2017 10:31:57 +1100 Subject: [PATCH] FIX, vanity mappings that are pointed to another page now update correctly. --- code/extensions/SiteTreeMisdirectionExtension.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/extensions/SiteTreeMisdirectionExtension.php b/code/extensions/SiteTreeMisdirectionExtension.php index 50365de..97e06d6 100644 --- a/code/extensions/SiteTreeMisdirectionExtension.php +++ b/code/extensions/SiteTreeMisdirectionExtension.php @@ -25,6 +25,12 @@ public function updateSettingsFields($fields) { 'VanityHeader', 'Vanity' )); + if($this->owner->VanityMapping()->RedirectPageID !== $this->owner->ID) { + + // The mapping may have been pointed to another page. + + $this->owner->VanityMappingID = 0; + } $fields->addFieldToTab('Root.Misdirection', TextField::create( 'VanityURL', 'URL',