mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-08 06:16:02 +01:00
Fix issue with home.hide_in_urls move errors
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# v1.6.7
|
||||||
|
## xx/xx/2017
|
||||||
|
|
||||||
|
1. [](#bugfix)
|
||||||
|
* Removed broken `home.hide_in_urls` code in `AdminBaseController::save()` that was throwing move errors
|
||||||
|
|
||||||
# v1.6.6
|
# v1.6.6
|
||||||
## 10/27/2017
|
## 10/27/2017
|
||||||
|
|
||||||
|
|||||||
@@ -476,28 +476,10 @@ class AdminController extends AdminBaseController
|
|||||||
return false;
|
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();
|
$parent = $route && $route != '/' && $route != '.' && $route != '/.' ? $pages->dispatch($route, true) : $pages->root();
|
||||||
|
|
||||||
$original_order = intval(trim($obj->order(), '.'));
|
$original_order = intval(trim($obj->order(), '.'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
|
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
|
||||||
$obj = $obj->move($parent);
|
$obj = $obj->move($parent);
|
||||||
@@ -586,22 +568,6 @@ class AdminController extends AdminBaseController
|
|||||||
}
|
}
|
||||||
$admin_route = $this->admin->base;
|
$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;
|
$redirect_url = ($multilang ? '/' . $obj->language() : '') . $admin_route . '/' . $this->view . $route;
|
||||||
$this->setRedirect($redirect_url);
|
$this->setRedirect($redirect_url);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user