From f5d3c41cf3f7b176770389c9736f2e0650fd3c6d Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Wed, 10 May 2017 11:03:22 -0400 Subject: [PATCH] CRM-20550 - ensure all programatically added menus appear. --- CRM/Core/BAO/Navigation.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/Navigation.php b/CRM/Core/BAO/Navigation.php index d0105669b3..32f18b8680 100644 --- a/CRM/Core/BAO/Navigation.php +++ b/CRM/Core/BAO/Navigation.php @@ -439,9 +439,12 @@ ORDER BY parent_id, weight"; if (!isset($nodes[$origKey]['attributes']['navID'])) { $newKey = ++$maxNavID; $nodes[$origKey]['attributes']['navID'] = $newKey; - $nodes[$newKey] = $nodes[$origKey]; - unset($nodes[$origKey]); - $origKey = $newKey; + if ($origKey != $newKey) { + // If the keys are different, reset the array index to match. + $nodes[$newKey] = $nodes[$origKey]; + unset($nodes[$origKey]); + $origKey = $newKey; + } } if (isset($nodes[$origKey]['child']) && is_array($nodes[$origKey]['child'])) { self::_fixNavigationMenu($nodes[$origKey]['child'], $maxNavID, $nodes[$origKey]['attributes']['navID']); -- 2.25.1