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:
@@ -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'), '/');
|
||||
|
||||
Reference in New Issue
Block a user