diff --git a/library/Icinga/Web/Navigation/Navigation.php b/library/Icinga/Web/Navigation/Navigation.php index 9d22617fb..1500f9b9b 100644 --- a/library/Icinga/Web/Navigation/Navigation.php +++ b/library/Icinga/Web/Navigation/Navigation.php @@ -318,6 +318,28 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate return $a->getPriority() > $b->getPriority() ? 1 : -1; } + /** + * Try to find and return a item with the given or a similar name + * + * @param string $name + * + * @return NavigationItem + */ + protected function findItem($name) + { + $item = $this->getItem($name); + if ($item !== null) { + return $item; + } + + $loweredName = strtolower($name); + foreach ($this->getItems() as $item) { + if (strtolower($item->getName()) === $loweredName) { + return $item; + } + } + } + /** * Merge this navigation with the given one * @@ -331,7 +353,7 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate { foreach ($navigation as $item) { /** @var $item NavigationItem */ - if (($existingItem = $this->getItem($item->getName())) !== null) { + if (($existingItem = $this->findItem($item->getName())) !== null) { if ($existingItem->conflictsWith($item)) { $name = $item->getName(); do {