mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-04 14:50:59 +01:00
Assign the correct parent when copying a page
This commit is contained in:
@@ -882,12 +882,12 @@ class AdminController
|
||||
$pages = $this->grav['pages'];
|
||||
$data = $this->post;
|
||||
|
||||
// Find new parent page in order to build the path.
|
||||
$route = isset($data['route']) ? trim($data['route'], '/') : '';
|
||||
$parent = empty($route) ? $pages->root() : $pages->dispatch($data['route'], true);
|
||||
// And then get the current page.
|
||||
$page = $this->admin->page(true);
|
||||
|
||||
// Find new parent page in order to build the path.
|
||||
$parent = $page->parent() ?: $pages->root();
|
||||
|
||||
// Make a copy of the current page and fill the updated information into it.
|
||||
$page = $page->copy($parent);
|
||||
$this->preparePage($page);
|
||||
|
||||
Reference in New Issue
Block a user