mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Do not use $pages->dispatch() to find a page, it redirects!
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v1.10.0-rc.12
|
||||
## mm/dd/2020
|
||||
|
||||
1. [](#bugfix)
|
||||
* Use `Pages::find()` instead of `Pages::dispatch()` as we do not want to redirect out of admin
|
||||
|
||||
# v1.10.0-rc.11
|
||||
## 05/14/2020
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ class Admin
|
||||
$route = '/' . ltrim($this->route, '/');
|
||||
|
||||
/** @var PageInterface $page */
|
||||
$page = $pages->dispatch($route);
|
||||
$page = $pages->find($route);
|
||||
$parent_route = null;
|
||||
if ($page) {
|
||||
/** @var PageInterface $parent */
|
||||
@@ -490,7 +490,7 @@ class Admin
|
||||
$route = '/' . ltrim($grav['admin']->route, '/');
|
||||
|
||||
/** @var PageInterface $page */
|
||||
$page = $pages->dispatch($route);
|
||||
$page = $pages->find($route);
|
||||
$parent_route = null;
|
||||
if ($page) {
|
||||
$media = $page->media()->all();
|
||||
@@ -1250,7 +1250,7 @@ class Admin
|
||||
}
|
||||
|
||||
foreach ($pages->routes() as $url => $path) {
|
||||
$page = $pages->dispatch($url, true);
|
||||
$page = $pages->find($url, true);
|
||||
if ($page && $page->routable()) {
|
||||
$latest[$page->route()] = ['modified' => $page->modified(), 'page' => $page];
|
||||
}
|
||||
@@ -1817,7 +1817,7 @@ class Admin
|
||||
// Fix for entities in path causing looping...
|
||||
$path = urldecode($path);
|
||||
|
||||
$page = $path ? $pages->dispatch($path, true) : $pages->root();
|
||||
$page = $path ? $pages->find($path, true) : $pages->root();
|
||||
|
||||
if (!$page) {
|
||||
$slug = basename($path);
|
||||
@@ -1970,7 +1970,7 @@ class Admin
|
||||
$pages = static::enablePages();
|
||||
|
||||
if ($param_page) {
|
||||
$page = $pages->dispatch($param_page);
|
||||
$page = $pages->find($param_page);
|
||||
|
||||
$page_files = $this->getFiles('images', $page, $page_files, $filtered);
|
||||
$page_files = $this->getFiles('videos', $page, $page_files, $filtered);
|
||||
@@ -2204,7 +2204,7 @@ class Admin
|
||||
$pages->enablePages();
|
||||
|
||||
// If page is null, the default page does not exist, and we cannot route to it
|
||||
$page = $pages->dispatch('/', true);
|
||||
$page = $pages->find('/', true);
|
||||
if ($page) {
|
||||
// Set original route for the home page.
|
||||
$home = '/' . trim($grav['config']->get('system.home.alias'), '/');
|
||||
|
||||
@@ -1320,7 +1320,7 @@ class AdminController extends AdminBaseController
|
||||
}
|
||||
}
|
||||
|
||||
$parent = $route && $route !== '/' && $route !== '.' && $route !== '/.' ? $pages->dispatch($route, true) : $pages->root();
|
||||
$parent = $route && $route !== '/' && $route !== '.' && $route !== '/.' ? $pages->find($route, true) : $pages->root();
|
||||
$original_order = (int)trim($obj->order(), '.');
|
||||
|
||||
try {
|
||||
@@ -1747,7 +1747,7 @@ class AdminController extends AdminBaseController
|
||||
$pages = $this->admin::enablePages();
|
||||
|
||||
/** @var PageInterface $page */
|
||||
$page = $pages->dispatch($rawroute);
|
||||
$page = $pages->find($rawroute);
|
||||
|
||||
if ($page) {
|
||||
$child_type = $page->childType();
|
||||
|
||||
Reference in New Issue
Block a user