Skip to content

Commit

Permalink
Added new Collection::merge() method #1258
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jan 20, 2017
1 parent 9536f2e commit 5ecf240
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions system/src/Grav/Common/Page/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ public function copy()
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
*
Expand Down

0 comments on commit 5ecf240

Please sign in to comment.