I have a plugin that has a menu and in backend which basically has a button that calls the plugins default controller actionXXXX method.
The action does some database / api work then is meant to return a result in a results template.
I have no idea how plugins got so complicated in craft and Im about ready to give up after today. The plugin main file supplies EVENT_REGISTER_CP_URL_RULES
Event::on(
UrlManager::class,
UrlManager::EVENT_REGISTER_CP_URL_RULES,
function (RegisterUrlRulesEvent $event) {
$event->rules['mapit-api2entry/default/map-it'] = 'results';
}
);
The plugin form in the cp has a hidden action like so. Do I need admin here? I assume so because we are in the CP.
<input type="hidden" name="action" value="admin/actions/mapit-api2entry/default/map-it">
I can put the url "admin/actions/mapit-api2entry/default/map-it" in the browser and pull up my template as expected.
But when I hit the submit button I get:
Unable to resolve the request "admin/actions/mapit-api2entry/default/map-it".
How do I tell the plugin / cp the right route to use after the action is triggered? Is this case of camel -vs kebab somewhere?