diff --git a/system/src/Grav/Common/Page/Collection.php b/system/src/Grav/Common/Page/Collection.php index 139a58bc5..a37f46a27 100644 --- a/system/src/Grav/Common/Page/Collection.php +++ b/system/src/Grav/Common/Page/Collection.php @@ -145,6 +145,18 @@ class Collection extends Iterator implements PageCollectionInterface return $this; } + /** + * Set current page. + */ + public function setCurrent(string $path): void + { + reset($this->items); + + while (key($this->items) !== $path && key($this->items) !== null) { + next($this->items); + } + } + /** * Returns current page. *