KQL Plugin: I have setup a Page Model Method filterChildrenByCategories, which works fine in PHP, but via kql I get the Following error, any ideas whats wrong? in mentioned file âinterceptor.phpâ there is a method allowedMethods() which return emtpy array
{
"status": "error",
"message": "The method \"ProjectsPage::filterChildrenByCategories()\" is not allowed in the API context",
"code": 403,
"exception": "Kirby\\Exception\\PermissionException",
"key": "error.permission",
"file": "../site/plugins/kql/src/Kql/Interceptors/Interceptor.php",
"line": 38,
"details": [],
"route": "query"
}
I can get it to work, when I hardcode, my method name in site/plugins/kql/src/Kql/Interceptors/Cms/Model.php in allowedMethodsForModels() return value, but is there a better way, via custom plugin or config.php?
I need to match pages which can have multiple categories in a type: multiselect (or tags) field, against multiple categories (âORâ Filter) where
[X] cat1
[ ] cat2
[X] cat3
[ ] cat4
which I have stored in a js object of categories { name: cat${id}, selected: true }, which I mapped to a string:
cat1, cat3
to be able to use it in a single query (via kql plugin)
it should match:
title: page1
category: cat1, cat2
it also should match
title: page2
category: cat3, cat4, foo
and not match
title: page3
category: cat2, bar
I am not sure how to match with native filter methods, so I came up which the page method and custom filter, domyou have another idea or can put me in right direction?
I have a feeling that KQL doesnât allow custom methods as they may be potentially destructive. You might want to add a feature request in the kql repo and reference it here.