diff --git a/code/cms/DMSDocumentAddController.php b/code/cms/DMSDocumentAddController.php index a43982b..dcba191 100644 --- a/code/cms/DMSDocumentAddController.php +++ b/code/cms/DMSDocumentAddController.php @@ -201,9 +201,7 @@ class DMSDocumentAddController extends LeftAndMain } /** - * Return a link to a page. In SS <= 3.5 this is loaded from the session, whereas in SS >= 3.6 this is set - * explicitly to a class property on CMSMain. This method checks whether the URL handler to detect this ID - * exists on CMSMain, if so include it in the URL. + * Return a link to edit a page, deep linking into the document set given * * @param int $pageId * @param int $documentSetId @@ -211,12 +209,10 @@ class DMSDocumentAddController extends LeftAndMain */ protected function getPageEditLink($pageId, $documentSetId) { - // Only get configuration from CMSMain, not its descendants or extensions - $urlHandlers = (array) Config::inst()->get('CMSMain', 'url_handlers', Config::UNINHERITED); - $pageIdSegment = array_key_exists('EditForm/$ID', $urlHandlers) ? $pageId . '/' : ''; return Controller::join_links( - singleton('CMSPagesController')->Link(), - sprintf('edit/EditForm/%sfield/Document Sets/item/%d', $pageIdSegment, $documentSetId) + CMSPageEditController::singleton()->getEditForm($pageId)->FormAction(), + 'field/Document Sets/item', + $documentSetId ); } diff --git a/tests/cms/DMSDocumentAddControllerTest.php b/tests/cms/DMSDocumentAddControllerTest.php index 3fee715..a88eb01 100644 --- a/tests/cms/DMSDocumentAddControllerTest.php +++ b/tests/cms/DMSDocumentAddControllerTest.php @@ -78,15 +78,6 @@ class DMSDocumentAddControllerTest extends FunctionalTest $this->controller->setRequest($request); $this->assertContains('admin/pages', $this->controller->Backlink()); $this->assertContains('123', $this->controller->Backlink()); - - $urlHandlers = (array) Config::inst()->get('CMSMain', 'url_handlers', Config::UNINHERITED); - if (array_key_exists('EditForm/$ID', $urlHandlers)) { - // SS 3.6 and above, ensure that the page ID is in the edit URL - $this->assertContains('admin/pages/edit/EditForm/234', $this->controller->Backlink()); - } else { - // SS 3.5 and below, the page ID is loaded from the session - $this->assertNotContains('234', $this->controller->Backlink()); - } } /**