Skip to content

Commit 4023fad

Browse files
committed
Use function merge_primary_and_custom to merge custom/smart menu nodes with other primary navigation
Fixed moodle-an-hochschulen#344 and moodle-an-hochschulen#620
1 parent 39be9ad commit 4023fad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

classes/output/navigation/primary.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ public function export_for_template(?renderer_base $output = null): array {
107107
// Separate the menus for the bottom menu.
108108
$locationbottom = smartmenu::get_menus_forlocation(smartmenu::LOCATION_BOTTOM, $smartmenus);
109109

110-
// Merge the smart menu nodes which contain the main menu location with the primary and custom menu nodes.
111-
$menudata = array_merge($this->get_primary_nav(), $this->get_custom_menu($output), $mainmenu);
110+
// Merge the smart menu nodes which contain the main menu location with the custom menu nodes.
111+
$custommenus = array_merge($this->get_custom_menu($output), $mainmenu);
112+
113+
// Merge the smart menu and custom menu nodes which contain the main menu location with the primary nodes.
114+
// The function merge_primary_and_custom is needed cause it also sets the active node.
115+
$menudata = $this->merge_primary_and_custom($this->get_primary_nav(), $custommenus , false);
112116
$moremenu = new \core\navigation\output\more_menu((object) $menudata, 'navbar-nav', false);
113117

114118
// Menubar.

0 commit comments

Comments
 (0)