From bc0cb6be01a34179924e8bc9e13ce99ea9188baa Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Tue, 8 Mar 2022 17:23:24 +0800 Subject: [PATCH] MDL-74087 theme_boost: Remove breadcrumb nodes that exist in primary nav Generally, we want to avoid displaying any breadcrumb nodes which are already present in the primary navigation menu. Currently, this is done by manually specifying which breadcrumb node (by its identification key) should be removed. This change provides more reliable, automatic removal of these breadcrum nodes by utilizing the exising method remove_items_that_exist_in_navigation(). --- theme/boost/classes/boostnavbar.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/theme/boost/classes/boostnavbar.php b/theme/boost/classes/boostnavbar.php index 3b5d62ab3c9..f3152ab11b4 100644 --- a/theme/boost/classes/boostnavbar.php +++ b/theme/boost/classes/boostnavbar.php @@ -55,6 +55,9 @@ class boostnavbar implements \renderable { protected function prepare_nodes_for_boost(): void { global $PAGE; + // Remove the navbar nodes that already exist in the primary navigation menu. + $this->remove_items_that_exist_in_navigation($PAGE->primarynav); + // Defines whether section items with an action should be removed by default. $removesections = true; @@ -94,9 +97,6 @@ class boostnavbar implements \renderable { } } - $this->remove('myhome'); // Dashboard. - $this->remove('home'); - // Remove 'My courses' if we are in the module context. if ($this->page->context->contextlevel == CONTEXT_MODULE) { $this->remove('mycourses');