mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 16:26:32 +01:00
Update taskGetChildTypes() to use Flex Pages (works without the plugin) [#2087]
This commit is contained in:
@@ -26,6 +26,7 @@ use Grav\Common\Security;
|
||||
use Grav\Common\User\Interfaces\UserCollectionInterface;
|
||||
use Grav\Common\User\Interfaces\UserInterface;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Framework\Flex\Flex;
|
||||
use Grav\Framework\Psr7\Response;
|
||||
use Grav\Framework\RequestHandler\Exception\RequestException;
|
||||
use Grav\Plugin\Login\TwoFactorAuth\TwoFactorAuth;
|
||||
@@ -1851,17 +1852,13 @@ class AdminController extends AdminBaseController
|
||||
|
||||
$data = $this->post;
|
||||
|
||||
$rawroute = $data['rawroute'] ?? null;
|
||||
|
||||
if ($rawroute) {
|
||||
$pages = $this->admin::enablePages();
|
||||
|
||||
/** @var PageInterface $page */
|
||||
$page = $pages->find($rawroute);
|
||||
|
||||
if ($page) {
|
||||
$route = $data['rawroute'] ?? null;
|
||||
if ($route) {
|
||||
/** @var Flex $flex */
|
||||
$flex = $this->grav['flex'];
|
||||
$page = $flex->getObject(trim($route, '/'), 'pages');
|
||||
if ($page instanceof PageInterface) {
|
||||
$child_type = $page->childType();
|
||||
|
||||
if ($child_type !== '') {
|
||||
$this->admin->json_response = [
|
||||
'status' => 'success',
|
||||
@@ -1875,7 +1872,6 @@ class AdminController extends AdminBaseController
|
||||
$this->admin->json_response = [
|
||||
'status' => 'success',
|
||||
'child_type' => '',
|
||||
// 'message' => $this->admin::translate('PLUGIN_ADMIN.NO_CHILD_TYPE')
|
||||
];
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user