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().
This commit is contained in:
Mihail Geshoski 2022-03-08 17:23:24 +08:00
parent 01eb6d2e9b
commit bc0cb6be01

View File

@ -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');