From c3e7a4990484aa962ed470aebc45f9e6a4d70e77 Mon Sep 17 00:00:00 2001 From: mirche97 Date: Tue, 5 Sep 2023 16:15:11 +0200 Subject: [PATCH 1/4] fixed VirtualPage generating incorrect CMS edit links VirtualPage now uses AdminRootController config `url_base` to generate edit links --- code/Model/VirtualPage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 9d0573c292..0ab19137fb 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -3,6 +3,7 @@ namespace SilverStripe\CMS\Model; use Page; +use SilverStripe\Admin\AdminRootController; use SilverStripe\Core\Convert; use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList; @@ -247,7 +248,7 @@ public function getCMSFields() 'a', [ 'class' => 'cmsEditlink', - 'href' => 'admin/pages/edit/show/' . $this->CopyContentFromID, + 'href' => AdminRootController::config()->get('url_base') . '/pages/edit/show/' . $this->CopyContentFromID, ], _t(self::class . '.EditLink', 'edit') ); From da115d991012ffa58c995319377277aa58c7aaf1 Mon Sep 17 00:00:00 2001 From: mirche97 Date: Tue, 5 Sep 2023 16:36:22 +0200 Subject: [PATCH 2/4] use AdminRootController::get_admin_route() use AdminRootController::get_admin_route() instead of reading url_base directly from config --- code/Model/VirtualPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 0ab19137fb..477b6b6ca0 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -248,7 +248,7 @@ public function getCMSFields() 'a', [ 'class' => 'cmsEditlink', - 'href' => AdminRootController::config()->get('url_base') . '/pages/edit/show/' . $this->CopyContentFromID, + 'href' => AdminRootController::get_admin_route() . '/pages/edit/show/' . $this->CopyContentFromID, ], _t(self::class . '.EditLink', 'edit') ); From 9edc46f53dfd2cf62ee0e8d6634c6a33366fbfa3 Mon Sep 17 00:00:00 2001 From: mirche97 Date: Mon, 18 Sep 2023 18:15:54 +0200 Subject: [PATCH 3/4] Update code/Model/VirtualPage.php Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> --- code/Model/VirtualPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 477b6b6ca0..00df5f2a4f 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -248,7 +248,7 @@ public function getCMSFields() 'a', [ 'class' => 'cmsEditlink', - 'href' => AdminRootController::get_admin_route() . '/pages/edit/show/' . $this->CopyContentFromID, + 'href' => $this->CopyContentFrom()->CMSEditLink(), ], _t(self::class . '.EditLink', 'edit') ); From 5c0693398684fb073a05d394000076465c942613 Mon Sep 17 00:00:00 2001 From: mirche97 Date: Mon, 18 Sep 2023 18:16:02 +0200 Subject: [PATCH 4/4] Update code/Model/VirtualPage.php Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> --- code/Model/VirtualPage.php | 1 - 1 file changed, 1 deletion(-) diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 00df5f2a4f..d3ad4912ec 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -3,7 +3,6 @@ namespace SilverStripe\CMS\Model; use Page; -use SilverStripe\Admin\AdminRootController; use SilverStripe\Core\Convert; use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList;