mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
Fix for change in 3eb2a5664a
Handle in Admin the logic to strip home from Page routes and urls (optional)
This commit is contained in:
@@ -1074,10 +1074,27 @@ class AdminController
|
||||
|
||||
// Find new parent page in order to build the path.
|
||||
$route = !isset($data['route']) ? dirname($this->admin->route) : $data['route'];
|
||||
$parent = $route && $route != '/' ? $pages->dispatch($route, true) : $pages->root();
|
||||
|
||||
$obj = $this->admin->page(true);
|
||||
|
||||
$config = $this->grav['config'];
|
||||
$hide_home_route = $config->get('system.home.hide_in_urls', false);
|
||||
if ($hide_home_route) {
|
||||
$home_route = $config->get('system.home.alias');
|
||||
$topParent = $obj->topParent();
|
||||
if (isset($topParent)) {
|
||||
if ($topParent->route() == $home_route) {
|
||||
$baseRoute = (string) $topParent->route();
|
||||
if ($obj->parent() != $topParent) {
|
||||
$baseRoute .= $obj->parent()->route();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$route = isset($baseRoute) ? $baseRoute : null;
|
||||
}
|
||||
|
||||
$parent = $route && $route != '/' ? $pages->dispatch($route, true) : $pages->root();
|
||||
|
||||
$original_slug = $obj->slug();
|
||||
$original_order = intval(trim($obj->order(), '.'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user