mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-03 14:20:43 +01:00
Fix redirect after saving page
This commit is contained in:
@@ -1071,12 +1071,13 @@ class AdminController
|
||||
if ($this->view == 'pages') {
|
||||
/** @var Page\Pages $pages */
|
||||
$pages = $this->grav['pages'];
|
||||
$config = $this->grav['config'];
|
||||
|
||||
// Find new parent page in order to build the path.
|
||||
$route = !isset($data['route']) ? dirname($this->admin->route) : $data['route'];
|
||||
$obj = $this->admin->page(true);
|
||||
|
||||
$config = $this->grav['config'];
|
||||
//Handle system.home.hide_in_urls
|
||||
$hide_home_route = $config->get('system.home.hide_in_urls', false);
|
||||
if ($hide_home_route) {
|
||||
$home_route = $config->get('system.home.alias');
|
||||
@@ -1089,7 +1090,6 @@ class AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$route = isset($baseRoute) ? $baseRoute : null;
|
||||
}
|
||||
|
||||
@@ -1162,7 +1162,21 @@ class AdminController
|
||||
}
|
||||
}
|
||||
$admin_route = $this->grav['config']->get('plugins.admin.route');
|
||||
$redirect_url = '/' . ($multilang ? ($obj->language()) : '') . $admin_route . '/' . $this->view . $obj->route();
|
||||
|
||||
//Handle system.home.hide_in_urls
|
||||
$route = $obj->route();
|
||||
$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) {
|
||||
$route = (string) $topParent->route() . $route;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$redirect_url = '/' . ($multilang ? ($obj->language()) : '') . $admin_route . '/' . $this->view . $route;
|
||||
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user