Compare commits
2 Commits
2a07cf6763
...
3e5c6af1fb
Author | SHA1 | Date |
---|---|---|
Tony Air | 3e5c6af1fb | |
Tony Air | 306bc5e7dd |
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
Name: app-graphql
|
||||
After:
|
||||
- app-basics
|
||||
Only:
|
||||
classexists: 'SilverStripe\GraphQL\Schema\Schema'
|
||||
---
|
||||
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
SilverStripe\GraphQL\Schema\Registry\PluginRegistry:
|
||||
constructor:
|
||||
- 'App\GraphQL\URLLinkablePlugin'
|
||||
|
||||
SilverStripe\Control\Director:
|
||||
rules:
|
||||
graphql:
|
||||
Controller: '%$SilverStripe\GraphQL\Controller.default'
|
||||
Schema: default
|
||||
|
||||
SilverStripe\GraphQL\Schema\Schema:
|
||||
schemas:
|
||||
'*':
|
||||
config:
|
||||
max_query_nodes: 250 # default 500
|
||||
max_query_depth: 20 # default 15
|
||||
max_query_complexity: 200 # default unlimited
|
||||
default:
|
||||
src:
|
||||
- app/_graphql
|
||||
|
||||
SilverStripe\GraphQLDevTools\Controller:
|
||||
# show two schemas
|
||||
schemas:
|
||||
- default
|
||||
- admin
|
||||
# default schema that is selected
|
||||
default_schema: default
|
|
@ -1,16 +0,0 @@
|
|||
app:
|
||||
# Load everything in our MyApp\Models\ namespace that has the Versioned extension
|
||||
# unless the filename ends with .secret.php
|
||||
load:
|
||||
namespaceLoader:
|
||||
include:
|
||||
- App\Models\*
|
||||
extensionLoader:
|
||||
include:
|
||||
- SilverStripe\Versioned\Versioned
|
||||
apply:
|
||||
fields:
|
||||
'*': true
|
||||
operations:
|
||||
read: true
|
||||
readOne: true
|
|
@ -1,30 +0,0 @@
|
|||
modelConfig:
|
||||
Page:
|
||||
plugins:
|
||||
inheritance: true
|
||||
operations:
|
||||
read:
|
||||
plugins:
|
||||
readVersion: false
|
||||
paginateList: false
|
||||
readOne:
|
||||
plugins:
|
||||
getByLink:
|
||||
after: filter
|
||||
|
||||
DNADesign\Elemental\Models\ElementalArea:
|
||||
plugins:
|
||||
inheritance: true
|
||||
operations:
|
||||
read:
|
||||
plugins:
|
||||
readVersion: false
|
||||
paginateList: false
|
||||
DNADesign\Elemental\Models\BaseElement:
|
||||
plugins:
|
||||
inheritance: true
|
||||
operations:
|
||||
read:
|
||||
plugins:
|
||||
readVersion: false
|
||||
paginateList: false
|
|
@ -1,49 +0,0 @@
|
|||
Page:
|
||||
fields:
|
||||
id: true
|
||||
className: true
|
||||
urlSegment: true
|
||||
parentID: true
|
||||
title: true
|
||||
sort: true
|
||||
CSSClass: true
|
||||
MainContent:
|
||||
type: String
|
||||
showInMenus: Boolean
|
||||
showInSearch: Boolean
|
||||
url:
|
||||
type: String
|
||||
link:
|
||||
type: String
|
||||
requestlink:
|
||||
type: String
|
||||
children: "[Page]"
|
||||
elementalArea:
|
||||
type: ElementalArea
|
||||
operations:
|
||||
read: true
|
||||
readOne:
|
||||
plugins:
|
||||
getByLink:
|
||||
after: filter
|
||||
|
||||
DNADesign\Elemental\Models\ElementalArea:
|
||||
fields:
|
||||
id: true
|
||||
elements:
|
||||
plugins:
|
||||
paginateList: false
|
||||
operations:
|
||||
read: true
|
||||
readOne: true
|
||||
|
||||
DNADesign\Elemental\Models\BaseElement:
|
||||
fields:
|
||||
id: true
|
||||
title: true
|
||||
showTitle: true
|
||||
className: true
|
||||
forTemplate: true
|
||||
operations:
|
||||
readOne: true
|
||||
read: true
|
|
@ -1,4 +0,0 @@
|
|||
queries:
|
||||
readMenu:
|
||||
type: '[PageInterface]'
|
||||
resolver: [ 'App\GraphQL\MenuResolver', 'resolveMenu' ]
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -358,13 +358,14 @@
|
|||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./app/client/src/js/app.js|eb4107b6469981f1941805b531f96e3b": 6216,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./app/client/src/js/types/SilverShop.Page.CheckoutPageController.js": 90,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./app/client/src/js/types/Site.Controllers.MapElementController.js|7710c2d960b7303acdac06c60f564d3b": 9718,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/_events.js": 3131,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/graphql.js": 3939,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/index.js": 2301,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/page/index.js": 3554,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/page/tpl.js": 3038,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/queries/page.js": 5816,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.5_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/router.js": 7253,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/_events.js": 1882,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/graphql.js": 8586,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/index.js": 393,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/page/index.js": 5616,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/page/tpl.js": 3058,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/queries/page.js": 1513,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/ui/router.js": 1103,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+mithril-ui@0.0.6_@popperjs+core@2.11.8/node_modules/@a2nt/mithril-ui/src/js/util/getParents.js": 6187,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/@a2nt+ss-bootstrap-ui-webpack-boilerplate-react@5.0.9_zone.js@0.13.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/js/main/funcs.js": 9095,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js": 1082,
|
||||
"./node_modules/.pnpm/babel-loader@9.1.3_@babel+core@7.23.2_webpack@5.89.0/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/mithril@2.2.2/node_modules/mithril/api/mount-redraw.js": 7481,
|
||||
|
@ -412,30 +413,30 @@
|
|||
0,
|
||||
58,
|
||||
90,
|
||||
393,
|
||||
499,
|
||||
809,
|
||||
1082,
|
||||
1103,
|
||||
1225,
|
||||
1381,
|
||||
1513,
|
||||
1545,
|
||||
1712,
|
||||
1882,
|
||||
1989,
|
||||
2103,
|
||||
2119,
|
||||
2125,
|
||||
2301,
|
||||
2584,
|
||||
2597,
|
||||
2941,
|
||||
2982,
|
||||
3038,
|
||||
3131,
|
||||
3058,
|
||||
3460,
|
||||
3526,
|
||||
3554,
|
||||
3565,
|
||||
3665,
|
||||
3939,
|
||||
4023,
|
||||
4782,
|
||||
4811,
|
||||
|
@ -444,17 +445,18 @@
|
|||
5415,
|
||||
5550,
|
||||
5598,
|
||||
5816,
|
||||
5616,
|
||||
5954,
|
||||
6187,
|
||||
6216,
|
||||
6461,
|
||||
6743,
|
||||
7253,
|
||||
7464,
|
||||
7481,
|
||||
7609,
|
||||
7815,
|
||||
8392,
|
||||
8586,
|
||||
8679,
|
||||
8764,
|
||||
9095,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,11 @@
|
|||
import '@a2nt/mithril-ui/src/js/ui'
|
||||
const m = require("mithril") // eslint-disable-line
|
||||
|
||||
const MainContent = document.getElementById('MainContent')
|
||||
const MainContentContainer = document.getElementById('MainContent')
|
||||
|
||||
const MainContent = document.createElement('div')
|
||||
MainContent.classList.add('page--container')
|
||||
MainContentContainer.append(MainContent)
|
||||
|
||||
const page = require('@a2nt/mithril-ui/src/js/ui/page/tpl')
|
||||
m.mount(MainContent, page)
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\GraphQL;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\ORM\Filterable;
|
||||
|
||||
class MenuResolver
|
||||
{
|
||||
public static function resolveLinksFilter(Filterable $list, array $args, array $context)
|
||||
{
|
||||
var_dump($context);
|
||||
die('aaaa');
|
||||
return $list;
|
||||
}
|
||||
|
||||
public static function resolveMenu(): array
|
||||
{
|
||||
$pages = SiteTree::get()->filter('ParentID', '0');
|
||||
$results = self::getFields($pages);
|
||||
return $results;
|
||||
}
|
||||
|
||||
protected static function getFields($pages): array
|
||||
{
|
||||
$results = [];
|
||||
foreach ($pages as $p) {
|
||||
$results[] = [
|
||||
'id' => $p->ID,
|
||||
'title' => $p->Title,
|
||||
'children' => self::getFields($p->Children()),
|
||||
];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
|
@ -1,277 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\GraphQL;
|
||||
|
||||
use GraphQL\Type\Definition\ResolveInfo;
|
||||
use SilverStripe\CMS\Controllers\ModelAsController;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
use SilverStripe\Dev\Debug;
|
||||
use SilverStripe\GraphQL\Controller;
|
||||
use SilverStripe\GraphQL\Schema\DataObject\Plugin\QueryFilter\QueryFilter;
|
||||
use SilverStripe\GraphQL\Schema\Exception\SchemaBuilderException;
|
||||
use SilverStripe\GraphQL\Schema\Field\ModelQuery;
|
||||
use SilverStripe\GraphQL\Schema\Interfaces\ModelQueryPlugin;
|
||||
use SilverStripe\GraphQL\Schema\Schema;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\DataList;
|
||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||
use SilverStripe\View\ArrayData;
|
||||
use SilverStripe\View\SSViewer;
|
||||
|
||||
if (!interface_exists(ModelQueryPlugin::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
class URLLinkablePlugin implements ModelQueryPlugin
|
||||
{
|
||||
use Configurable;
|
||||
use Injectable;
|
||||
|
||||
public const IDENTIFIER = 'getByURL';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @config
|
||||
*/
|
||||
private static $single_field_name = 'url';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @config
|
||||
*/
|
||||
private static $list_field_name = 'urls';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $resolver = [__CLASS__, 'applyURLFilter'];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier(): string
|
||||
{
|
||||
return self::IDENTIFIER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModelQuery $query
|
||||
* @param Schema $schema
|
||||
* @param array $config
|
||||
*/
|
||||
public function apply(ModelQuery $query, Schema $schema, array $config = []): void
|
||||
{
|
||||
$class = $query->getModel()->getSourceClass();
|
||||
// Only site trees have the get_by_link capability
|
||||
if ($class !== SiteTree::class && !is_subclass_of($class, SiteTree::class)) {
|
||||
return;
|
||||
}
|
||||
$singleFieldName = $this->config()->get('single_field_name');
|
||||
$listFieldName = $this->config()->get('list_field_name');
|
||||
$fieldName = $query->isList() ? $listFieldName : $singleFieldName;
|
||||
$type = $query->isList() ? '[String]' : 'String';
|
||||
$query->addArg($fieldName, $type);
|
||||
$query->addResolverAfterware(
|
||||
$config['resolver'] ?? static::config()->get('resolver')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $context
|
||||
* @return callable
|
||||
*/
|
||||
public static function applyURLFilter($obj, array $args, array $context, ResolveInfo $info)
|
||||
{
|
||||
$url = self::getURL($args);
|
||||
if (!$url) {
|
||||
return $obj;
|
||||
}
|
||||
|
||||
$controller = self::getURLController($url);
|
||||
|
||||
$obj = $controller->data();
|
||||
$obj->GraphQLContent = self::RenderTemplate($obj, $controller);
|
||||
|
||||
$result = ArrayList::create();
|
||||
$result->push($obj);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function getURL($args)
|
||||
{
|
||||
$singleFieldName = static::config()->get('single_field_name');
|
||||
$listFieldName = static::config()->get('list_field_name');
|
||||
|
||||
$filterLink = $args['filter'][$singleFieldName] ?? ($args['filter'][$listFieldName] ?? null);
|
||||
$argLink = $args[$singleFieldName] ?? ($args[$listFieldName] ?? null);
|
||||
|
||||
$linkData = $filterLink ?: $argLink;
|
||||
if (!$linkData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$url = $linkData['eq'];
|
||||
if ($url === '/') {
|
||||
return '/home';
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
protected static function getURLController($url)
|
||||
{
|
||||
$curr = Controller::curr();
|
||||
$req = clone $curr->getRequest();
|
||||
|
||||
$req->setUrl($url);
|
||||
$req->match('$URLSegment//$Action/$ID/$OtherID', true);
|
||||
|
||||
$controller = ModelAsController::create();
|
||||
$controller->setRequest($req);
|
||||
|
||||
// ContentController
|
||||
$result = $controller->getNestedController();
|
||||
$result->setRequest($req);
|
||||
|
||||
/** @var SiteTree $child */
|
||||
$action = $req->param('Action');
|
||||
|
||||
if ($action) {
|
||||
$child = self::findChild($action, $result);
|
||||
if ($child) {
|
||||
$result = $child;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// look recursively for a child page with URLSegment
|
||||
protected static function findChild($action, $controller)
|
||||
{
|
||||
$req = $controller->getRequest();
|
||||
|
||||
$child = SiteTree::get()->filter([
|
||||
'ParentID' => $controller->ID,
|
||||
'URLSegment' => $action,
|
||||
])->first();
|
||||
|
||||
if ($child) {
|
||||
$req->shiftAllParams();
|
||||
$req->shift();
|
||||
|
||||
$controller = ModelAsController::controller_for($child);
|
||||
$controller->setRequest($req);
|
||||
$action = $req->param('Action');
|
||||
|
||||
if ($action) {
|
||||
return self::findChild($action, $controller);
|
||||
}
|
||||
}
|
||||
|
||||
return $controller;
|
||||
}
|
||||
|
||||
// AJAX/GraphQL helper
|
||||
protected static function RenderTemplate($page, $ctl)
|
||||
{
|
||||
$object = $page;
|
||||
$req = $ctl->getRequest();
|
||||
$actionParam = $req->param('Action');
|
||||
|
||||
Director::set_current_page($object);
|
||||
|
||||
$match = self::findAction($ctl, $req);
|
||||
$req->match($match['rule'], true);
|
||||
$action = $match['action'];
|
||||
|
||||
$action = ($action === 'handleAction') ? $actionParam : $action;
|
||||
|
||||
$action = $action && $ctl->hasAction($action) ? $action : 'index';
|
||||
|
||||
|
||||
// find templates
|
||||
$tpl = 'Page';
|
||||
$tpls = SSViewer::get_templates_by_class($object->ClassName, '', \Page::class);
|
||||
|
||||
foreach ($tpls as $tpl) {
|
||||
if (is_array($tpl)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$a_tpl = explode('\\', $tpl);
|
||||
$last_name = array_pop($a_tpl);
|
||||
$a_tpl[] = 'Layout';
|
||||
$a_tpl[] = $last_name;
|
||||
$a_tpl = implode('\\', $a_tpl);
|
||||
|
||||
if (SSViewer::hasTemplate($a_tpl)) {
|
||||
$tpl = $a_tpl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
$tpl = is_array($tpl) ? 'Page' : $tpl;
|
||||
$tpl = ($tpl !== 'Page') ? $tpl : 'Layout/Page';
|
||||
|
||||
// a little dirty way to make forms working
|
||||
//Controller::curr()->config()->set('url_segment', $object->AbsoluteLink());
|
||||
//$ctl->doInit();
|
||||
|
||||
$mResult = $ctl->$action($req);
|
||||
if (is_array($mResult) || is_a($mResult, ArrayData::class)) {
|
||||
$ctl->customise($mResult);
|
||||
}
|
||||
|
||||
|
||||
$layout = $ctl->renderWith([$tpl.'_'.$action, $tpl]);
|
||||
|
||||
return $ctl
|
||||
->customise(['Layout' => $layout])
|
||||
->renderWith('GraphQLPage');
|
||||
}
|
||||
|
||||
protected static function findAction($controller, $request)
|
||||
{
|
||||
$handlerClass = $controller::class;
|
||||
|
||||
// We stop after RequestHandler; in other words, at ViewableData
|
||||
while ($handlerClass && $handlerClass != ViewableData::class) {
|
||||
$urlHandlers = Config::inst()->get($handlerClass, 'url_handlers', Config::UNINHERITED);
|
||||
|
||||
if ($urlHandlers) {
|
||||
foreach ($urlHandlers as $rule => $action) {
|
||||
if (isset($_REQUEST['debug_request'])) {
|
||||
$class = static::class;
|
||||
$remaining = $request->remaining();
|
||||
Debug::message("Testing '{$rule}' with '{$remaining}' on {$class}");
|
||||
}
|
||||
|
||||
if ($request->match($rule, true)) {
|
||||
if (isset($_REQUEST['debug_request'])) {
|
||||
$class = static::class;
|
||||
$latestParams = var_export($request->latestParams(), true);
|
||||
Debug::message(
|
||||
"Rule '{$rule}' matched to action '{$action}' on {$class}. " . "Latest request params: {$latestParams}"
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'rule' => $rule,
|
||||
'action' => $action,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$handlerClass = get_parent_class($handlerClass ?? '');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -97,26 +97,6 @@ class Page extends SiteTree
|
|||
return str_replace(['\\'], '-', $this->getField('ClassName'));
|
||||
}
|
||||
|
||||
// AJAX/GraphQL helper
|
||||
public function MainContent()
|
||||
{
|
||||
$object = $this;
|
||||
return isset($object->GraphQLContent) ? $object->GraphQLContent : null;
|
||||
}
|
||||
|
||||
public function getRequestLink($action = null)
|
||||
{
|
||||
$curr = Controller::curr();
|
||||
if ($curr::class === GraphQLController::class) {
|
||||
$vars = json_decode($curr->getRequest()->getBody(), true)['variables'];
|
||||
if (isset($vars['url'])) {
|
||||
return $vars['url'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
parent::onBeforeWrite();
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@a2nt/meta-lightbox-js": "^4.2.7",
|
||||
"@a2nt/mithril-ui": "^0.0.5",
|
||||
"@a2nt/mithril-ui": "^0.0.6",
|
||||
"@a2nt/ss-bootstrap-ui-webpack-boilerplate-react": "^5.0.9",
|
||||
"@angular/common": "^16.2.10",
|
||||
"@angular/core": "^16.2.10",
|
||||
|
@ -105,8 +105,8 @@
|
|||
"@googlemaps/markerclusterer": "^2.5.0",
|
||||
"@sucrase/webpack-loader": "^2.0.0",
|
||||
"@ungap/global-this": "^0.4.4",
|
||||
"@wry/context": "^0.7.3",
|
||||
"@wry/equality": "^0.5.6",
|
||||
"@wry/context": "^0.7.4",
|
||||
"@wry/equality": "^0.5.7",
|
||||
"@wry/trie": "^0.4.3",
|
||||
"animate.css": "^4.1.1",
|
||||
"ansi-html": "^0.0.9",
|
||||
|
|
Loading…
Reference in New Issue