mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
FIX Remove fragile logic looking for page edit link between SS versions
This commit is contained in:
parent
4bdeb980d9
commit
4ba3e3fa60
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user