mirror of
https://github.com/getgrav/grav.git
synced 2026-07-06 01:19:30 +02:00
get route() dynamically and add any route aliases
This commit is contained in:
@@ -626,21 +626,20 @@ class Pages
|
||||
// Build routes and taxonomy map.
|
||||
/** @var $page Page */
|
||||
foreach ($this->instances as $page) {
|
||||
$parent = $page->parent();
|
||||
$route = null;
|
||||
if (!$page->root()) {
|
||||
// process taxonomy
|
||||
$taxonomy->addTaxonomy($page);
|
||||
|
||||
if ($parent) {
|
||||
// $route = rtrim($parent->route(), '/') . '/' . $page->slug();
|
||||
$route = $page->route();
|
||||
// add route
|
||||
$this->routes[$page->route()] = $page->path();
|
||||
|
||||
// $page->route($route);
|
||||
}
|
||||
|
||||
if (!empty($route)) {
|
||||
$taxonomy->addTaxonomy($page);
|
||||
} else {
|
||||
$page->routable(false);
|
||||
// add aliases to routes list if they are provided
|
||||
$route_aliases = $page->routeAliases();
|
||||
if ($route_aliases) {
|
||||
foreach ($route_aliases as $alias) {
|
||||
$this->routes[$alias] = $page->path();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user