REFACTOR: Remove duplication and set SiteTree instances to use generic CMSEditLink()

This commit is contained in:
mattclegg 2020-04-10 09:12:39 +05:45
parent d85cc24aa0
commit 58795a2324
No known key found for this signature in database
GPG Key ID: 68C4C8DB2D0D1DFE

View File

@ -1690,10 +1690,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
/** @var SiteTree $item */
$title = sprintf(
'<a class="action-detail" href="%s">%s</a>',
Controller::join_links(
CMSPageEditController::singleton()->Link('show'),
(int)$item->ID
),
$item->CMSEditLink(),
$item->TreeTitle // returns HTML, does its own escaping
);
$breadcrumbs = $item->Breadcrumbs(20, true, false, true, '/');
@ -2101,7 +2098,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// Can be used in different contexts: In normal page edit view, in which case the redirect won't have any effect.
// Or in history view, in which case a revert causes the CMS to re-load the edit view.
// The X-Pjax header forces a "full" content refresh on redirect.
$url = Controller::join_links(CMSPageEditController::singleton()->Link('show'), $record->ID);
$url = $record->CMSEditLink();
$this->getResponse()->addHeader('X-ControllerURL', $url);
$this->getRequest()->addHeader('X-Pjax', 'Content');
$this->getResponse()->addHeader('X-Pjax', 'Content');
@ -2287,7 +2284,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
array('title' => $newPage->Title)
))
);
$url = Controller::join_links(CMSPageEditController::singleton()->Link('show'), $newPage->ID);
$url = $newPage->CMSEditLink();
$this->getResponse()->addHeader('X-ControllerURL', $url);
$this->getRequest()->addHeader('X-Pjax', 'Content');
$this->getResponse()->addHeader('X-Pjax', 'Content');
@ -2325,7 +2322,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
array('title' => $newPage->Title)
))
);
$url = Controller::join_links(CMSPageEditController::singleton()->Link('show'), $newPage->ID);
$url = $newPage->CMSEditLink();
$this->getResponse()->addHeader('X-ControllerURL', $url);
$this->getRequest()->addHeader('X-Pjax', 'Content');
$this->getResponse()->addHeader('X-Pjax', 'Content');