diff --git a/theme/boost/classes/boostnavbar.php b/theme/boost/classes/boostnavbar.php index bd33f611b659c..c438148375923 100644 --- a/theme/boost/classes/boostnavbar.php +++ b/theme/boost/classes/boostnavbar.php @@ -73,8 +73,11 @@ protected function prepare_nodes_for_boost(): void { // Remove 'My courses' and 'Courses' if we are in the course context. $this->remove('mycourses'); $this->remove('courses'); - // Remove the course category breadcrumb node. - $this->remove($this->page->course->category, \breadcrumb_navigation_node::TYPE_CATEGORY); + // Remove the course category breadcrumb nodes. + foreach ($this->items as $key => $item) { + // Remove if it is a course category breadcrumb node. + $this->remove($item->key, \breadcrumb_navigation_node::TYPE_CATEGORY); + } // Remove the course breadcrumb node. $this->remove($this->page->course->id, \breadcrumb_navigation_node::TYPE_COURSE); // Remove the navbar nodes that already exist in the secondary navigation menu. @@ -103,8 +106,11 @@ protected function prepare_nodes_for_boost(): void { if ($this->page->context->contextlevel == CONTEXT_MODULE) { $this->remove('mycourses'); $this->remove('courses'); - // Remove the course category breadcrumb node. - $this->remove($this->page->course->category, \breadcrumb_navigation_node::TYPE_CATEGORY); + // Remove the course category breadcrumb nodes. + foreach ($this->items as $key => $item) { + // Remove if it is a course category breadcrumb node. + $this->remove($item->key, \breadcrumb_navigation_node::TYPE_CATEGORY); + } $courseformat = course_get_format($this->page->course)->get_course(); // Section items can be only removed if a course layout (coursedisplay) is not explicitly set in the // given course format or the set course layout is not 'One section per page'.