mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 03:46:30 +01:00
Fix page saving in expert mode (/ != /home)
This commit is contained in:
@@ -11,6 +11,7 @@ use Grav\Common\Uri;
|
|||||||
use Grav\Common\Page\Pages;
|
use Grav\Common\Page\Pages;
|
||||||
use Grav\Common\Page\Page;
|
use Grav\Common\Page\Page;
|
||||||
use Grav\Common\Data;
|
use Grav\Common\Data;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
class Admin
|
class Admin
|
||||||
{
|
{
|
||||||
@@ -398,8 +399,8 @@ class Admin
|
|||||||
// Found the type and header from the session.
|
// Found the type and header from the session.
|
||||||
$data = $this->session->{$page->route()};
|
$data = $this->session->{$page->route()};
|
||||||
$page->name($data['type'] . '.md');
|
$page->name($data['type'] . '.md');
|
||||||
$page->frontmatter('title: ' . $data['title']);
|
|
||||||
$page->header(['title' => $data['title']]);
|
$page->header(['title' => $data['title']]);
|
||||||
|
$page->frontmatter(Yaml::dump((array) $page->header()));
|
||||||
} else {
|
} else {
|
||||||
// Find out the type by looking at the parent.
|
// Find out the type by looking at the parent.
|
||||||
$type = $parent->child_type() ? $parent->child_type() : $parent->blueprints()->get('child_type', 'default');
|
$type = $parent->child_type() ? $parent->child_type() : $parent->blueprints()->get('child_type', 'default');
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ class AdminController
|
|||||||
|
|
||||||
// Find new parent page in order to build the path.
|
// Find new parent page in order to build the path.
|
||||||
$route = !isset($data['route']) ? dirname($this->admin->route) : $data['route'];
|
$route = !isset($data['route']) ? dirname($this->admin->route) : $data['route'];
|
||||||
$parent = $route ? $pages->dispatch($route, true) : $pages->root();
|
$parent = $route && $route != '/' ? $pages->dispatch($route, true) : $pages->root();
|
||||||
$obj = $this->admin->page(true);
|
$obj = $this->admin->page(true);
|
||||||
|
|
||||||
// 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).
|
||||||
|
|||||||
Reference in New Issue
Block a user