mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-69588 navigation: Utilize showinsecondarynavigation in secondary nav
Utilizes the 'showinsecondarynavigation' property from the navigation_node object to avoid displaying any unwanted nodes in the secondary navigation.
This commit is contained in:
parent
bddc64a39d
commit
f836887844
@ -173,6 +173,7 @@ class secondary extends view {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->remove_unwanted_nodes();
|
||||
$this->force_nodes_into_more_menu($defaultmoremenunodes);
|
||||
// Search and set the active node.
|
||||
$this->scan_for_active_node($this);
|
||||
@ -338,4 +339,15 @@ class secondary extends view {
|
||||
$displayednodescount++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove navigation nodes that should not be displayed in the secondary navigation.
|
||||
*/
|
||||
protected function remove_unwanted_nodes() {
|
||||
foreach ($this->children as $child) {
|
||||
if (!$child->showinsecondarynavigation) {
|
||||
$child->remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user