Hey guys,
I’m trying to build a formular with the help of the Uniform plugin by @mzur: https://github.com/mzur/kirby-uniform
The formular should send the data to a URL within the same kirby installation, which is done with a webhook and a custom kirby route. But here’s the problem: no matter which options I change and how I implement the route, the route doesn’t work – I always get the 404 error page as a remote response. If I try to access the routed URL directly, it works perfectly.
The relevant code snippets are:
// site/plugins/api/api.php
// API routing is done here
<?php
kirby()->routes([
[
'pattern' => 'api/drabo/signup',
'method' => 'POST',
'action' => function(){
// try to trigger the error response for uniform doesn't work
return response::error($msg);
]
]);
// My formular controller
// site/controllers/signup.php
<?php
return function($site, $pages, $page){
// set required array; this works perfect
$required = […];
$formular = uniform($formid, [
'required' => $required,
'actions' => [
[
'_action' => 'webhook',
'url' => 'http://local-url/api/drabo/signup',
'params' => [
'method' => 'POST'
]
]
]
]);
};
Validating the formular, sending emails etc. does work, so there seems to be no problem with uniform itself, but with the routing (and/or the combination from both). I already tried removing the method(s), and changing the URL, but without success.
Has anyone a hint for me, and/or experience with Uniform plugin and webhooks?