-
Notifications
You must be signed in to change notification settings - Fork 0
Allow Override for site/search
Route (for customizing Panel Search)
#573
Comments
If I remember correctly, overriding the API routes should work: https://getkirby.com/docs/reference/plugins/extensions/api#custom-endpoints |
@lukasbestle I could not get get Plugin example. (The Kirby::plugin('sitesearch/test', [
'api' => [
'routes' => function ($kirby) {
return [
[
'pattern' => 'site/search',
'method' => 'GET|POST',
'action' => function () {
die("Test");
return $this->site()->children();
}
],
];
},
],
]); This would be expected based on my understanding of how |
You are right, the extension routes are merged after the system API routes. Now that I think about it, that's probably on purpose to prevent plugins from breaking the Panel. But this means that there needs to be a different solution to customize the Panel search. |
@neildaniels what you could do as a workaround right now: Extend the panel.plugin("your/search", {
components: {
"k-search": {
extends: "k-search",
computed: {
types() {
...
}
}
}
}); |
I just discussed this with @distantnative and the search component is really intended to overwrite the search filter for collections. It's not meant to replace the entire
site()->index()
logic. If you want to do that you can replace the API route with a custom one and make sure that you run your own search logic in there. But we've added to our todo list to find a better global way of handling search in general in a later release.Originally posted by @bastianallgeier in #570 (comment)
This makes sense, but
api
routes cannot be overridden currently, making this seem infeasible.https://github.com/getkirby/kirby/blob/de728405c3c4813fcad6dd2361ffa373b97d688b/config/routes.php#L24-L48
https://github.com/getkirby/kirby/blob/de728405c3c4813fcad6dd2361ffa373b97d688b/src/Cms/App.php#L1166-L1177
The text was updated successfully, but these errors were encountered: