aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2013-05-23 12:35:06 -0400
committerBrett Profitt <brett.profitt@gmail.com>2013-05-23 12:35:06 -0400
commitf49e7f3fbdf3173b4dc548eab568c5fae1b773d3 (patch)
tree7087726f0ee187bc00da108d9dca7b0d935eec98
parentd86e7c479f30b958fed4e746536b8e402d91f0d6 (diff)
downloadelgg-f49e7f3fbdf3173b4dc548eab568c5fae1b773d3.tar.gz
elgg-f49e7f3fbdf3173b4dc548eab568c5fae1b773d3.tar.bz2
Fixes #5522. Only adding children elements to menu items if they haven't already been added.
-rw-r--r--engine/classes/ElggMenuBuilder.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php
index 198018f3c..26b0de734 100644
--- a/engine/classes/ElggMenuBuilder.php
+++ b/engine/classes/ElggMenuBuilder.php
@@ -128,8 +128,11 @@ class ElggMenuBuilder {
$parent_name = $menu_item->getParentName();
if (array_key_exists($parent_name, $current_gen)) {
$next_gen[$menu_item->getName()] = $menu_item;
- $current_gen[$parent_name]->addChild($menu_item);
- $menu_item->setParent($current_gen[$parent_name]);
+ $data = $current_gen[$parent_name]->getData();
+ if (!in_array($menu_item, $current_gen[$parent_name]->getData('children'))) {
+ $current_gen[$parent_name]->addChild($menu_item);
+ $menu_item->setParent($current_gen[$parent_name]);
+ }
unset($children[$index]);
}
}