MDL-78138 theme_boost: Reliably remove TYPE_CATEGORY breadcrumbs.

This commit is contained in:
Luca Bösch 2023-05-08 07:06:38 +02:00
parent 6628845087
commit 18dfb832d1

View File

@ -73,8 +73,11 @@ class boostnavbar implements \renderable {
// 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 @@ class boostnavbar implements \renderable {
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'.