Navigation: Add method merge()

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-02 13:34:56 +02:00
parent a4c2081f64
commit 29413360d9
1 changed files with 18 additions and 0 deletions

View File

@ -269,6 +269,24 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate
return new RecursiveNavigationRenderer($this);
}
/**
* Merge this navigation with the given one
*
* Any duplicate items of this navigation will be overwritten by the given navigation's items.
*
* @param Navigation $navigation
*
* @return $this
*/
public function merge(Navigation $navigation)
{
foreach ($navigation as $item) {
$this->addItem($item);
}
return $this;
}
/**
* Create and return a new set of navigation items for the given configuration
*