mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 11:31:43 +01:00
Merge branch 'develop' of github.com:getgrav/grav into develop
This commit is contained in:
@@ -78,13 +78,35 @@ class Route
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
* @return string
|
||||
*/
|
||||
public function getRoute()
|
||||
public function getRoute($offset = 0, $length = null)
|
||||
{
|
||||
if ($offset !== 0 || $length !== null) {
|
||||
return ($offset === 0 ? '/' : '') . implode('/', $this->getRouteParts($offset, $length));
|
||||
}
|
||||
|
||||
return '/' . $this->route;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
* @return array
|
||||
*/
|
||||
public function getRouteParts($offset = 0, $length = null)
|
||||
{
|
||||
$parts = explode('/', $this->route);
|
||||
|
||||
if ($offset !== 0 || $length !== null) {
|
||||
$parts = array_slice($parts, $offset, $length);
|
||||
}
|
||||
|
||||
return $parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of both query and Grav parameters.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user