mirror of
https://github.com/getgrav/grav.git
synced 2026-03-06 20:41:36 +01:00
Added new Collection::merge() method #1258
This commit is contained in:
@@ -74,6 +74,21 @@ class Collection extends Iterator
|
||||
return new static($this->items, $this->params, $this->pages);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Merge another collection with the current collection
|
||||
*
|
||||
* @param Collection $collection
|
||||
* @return $this
|
||||
*/
|
||||
public function merge(Collection $collection)
|
||||
{
|
||||
foreach($collection as $page) {
|
||||
$this->addPage($page);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters to the Collection
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user