From abc5556520f891d0e3f5cf3d2c3838a194ac5335 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 20 Jan 2016 15:28:58 +1300 Subject: [PATCH] BUG Fix legacy breadcrumbs appearing on page save Fixes #1358 --- code/controllers/CMSMain.php | 10 +++++----- code/controllers/CMSPageEditController.php | 6 ------ templates/Includes/CMSMain_Content.ss | 14 +------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index ece881b4..ba1efdc2 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -409,11 +409,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr public function Breadcrumbs($unlinked = false) { $items = parent::Breadcrumbs($unlinked); - // The root element should point to the pages tree view, - // rather than the actual controller (which would just show an empty edit form) - $defaultTitle = self::menu_title_for_class('CMSPagesController'); - $items[0]->Title = _t("{$this->class}.MENUTITLE", $defaultTitle); - $items[0]->Link = singleton('CMSPagesController')->Link(); + if($items->count() > 1) { + // Specific to the SiteTree admin section, we never show the cms section and current + // page in the same breadcrumbs block. + $items->shift(); + } return $items; } diff --git a/code/controllers/CMSPageEditController.php b/code/controllers/CMSPageEditController.php index e97d9af7..1bbf826a 100644 --- a/code/controllers/CMSPageEditController.php +++ b/code/controllers/CMSPageEditController.php @@ -11,10 +11,4 @@ class CMSPageEditController extends CMSMain { private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; private static $session_namespace = 'CMSMain'; - public function Breadcrumbs($unlinked = false) { - $crumbs = parent::Breadcrumbs($unlinked); - $crumbs[0]->Title = _t('CMSPagesController.MENUTITLE'); - return $crumbs; - } - } diff --git a/templates/Includes/CMSMain_Content.ss b/templates/Includes/CMSMain_Content.ss index 039be30c..e6a179c3 100644 --- a/templates/Includes/CMSMain_Content.ss +++ b/templates/Includes/CMSMain_Content.ss @@ -4,19 +4,7 @@
- + <% include CMSBreadcrumbs %>