fix copying of pages [fixes #43]

This commit is contained in:
Gert
2015-04-27 17:43:58 +02:00
parent 9b95c115af
commit e8209094a5

View File

@@ -718,8 +718,7 @@ class AdminController
$data = $this->post; $data = $this->post;
// Find new parent page in order to build the path. // Find new parent page in order to build the path.
$parent = empty($data['route']) ? $pages->root() : $pages->dispatch($data['route'], true); $parent = empty(trim($data['route'], '/')) ? $pages->root() : $pages->dispatch($data['route'], true);
// And then get the current page. // And then get the current page.
$page = $this->admin->page(true); $page = $this->admin->page(true);
@@ -727,6 +726,9 @@ class AdminController
$page = $page->copy($parent); $page = $page->copy($parent);
$this->preparePage($page); $this->preparePage($page);
// Make sure the header is loaded in case content was set through raw() (expert mode)
$page->header();
// Deal with folder naming conflicts, but limit number of searches to 99. // Deal with folder naming conflicts, but limit number of searches to 99.
$break = 99; $break = 99;
while ($break > 0 && file_exists($page->filePath())) { while ($break > 0 && file_exists($page->filePath())) {