Added current position to page object (#1632)

This commit is contained in:
Mike Mellor
2017-09-05 20:57:32 +01:00
committed by Andy Miller
parent 9147a10cc7
commit 8532c2d06e

View File

@@ -2269,6 +2269,23 @@ class Page
return false;
}
/**
* Returns the item in the current position.
*
* @param string $path the path the item
*
* @return Integer the index of the current page.
*/
public function currentPosition()
{
$collection = $this->parent()->collection('content', false);
if ($collection instanceof Collection) {
return $collection->currentPosition($this->path());
}
return true;
}
/**
* Returns whether or not this page is the currently active page requested via the URL.