mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Fix issue with home.hide_in_urls move errors
This commit is contained in:
@@ -476,28 +476,10 @@ class AdminController extends AdminBaseController
|
||||
return false;
|
||||
}
|
||||
|
||||
//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');
|
||||
$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 != '/' && $route != '.' && $route != '/.' ? $pages->dispatch($route, true) : $pages->root();
|
||||
|
||||
$original_order = intval(trim($obj->order(), '.'));
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
|
||||
$obj = $obj->move($parent);
|
||||
@@ -586,22 +568,6 @@ class AdminController extends AdminBaseController
|
||||
}
|
||||
$admin_route = $this->admin->base;
|
||||
|
||||
//Handle system.home.hide_in_urls
|
||||
$route = $obj->rawRoute();
|
||||
$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)) {
|
||||
$top_parent_route = (string)$topParent->route();
|
||||
if ($top_parent_route == $home_route && substr($route, 0,
|
||||
strlen($top_parent_route) + 1) != ($top_parent_route . '/')
|
||||
) {
|
||||
$route = $top_parent_route . $route;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$redirect_url = ($multilang ? '/' . $obj->language() : '') . $admin_route . '/' . $this->view . $route;
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user