From 0a42ace4bac0153dce67be3c35cd9360ca205185 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 29 Jun 2015 15:30:32 -0600 Subject: [PATCH] added accessor for routeAliases --- system/src/Grav/Common/Page/Page.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index f60a867f9..83a73a074 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1136,7 +1136,8 @@ class Page } /** - * Gets the route for the page based on the parents route and the current Page's slug. + * Gets the route for the page based on the route headers if available, else from + * the parents route and the current Page's slug. * * @param string $var Set new default route. * @@ -1163,6 +1164,26 @@ class Page return $this->route; } + /** + * Gets the route aliases for the page based on page headers. + * + * @param array $var list of route aliases + * + * @return array The route aliases for the Page. + */ + public function routeAliases($var = null) + { + if ($var != null) { + $this->routes['aliases'] = (array) $var; + } + + if (!empty($this->routes) && isset($this->routes['aliases'])) { + return $this->routes['aliases']; + } else { + return []; + } + } + /** * Gets and sets the identifier for this Page object. *