struggling to decipher how to link a plugins controller to an action route. The docs say to use "https://pluginfactory.io/" to scaffold one, but what it generates is a different structure to what the documentation say to use.

I've got a plugin called Gated Content sitting inside: plugins/gated-content

I've got a controller named and located at:


with the class name of of GatedContent_DataCaptureController

I've just got an actionIndex method which var dumps and exits.

Which would suggest (according to the docs) that the URL to access this should be:


But it just throws a 404.

Inside of the .craftplugin file I've also added "controllerName":"GatedContent_DataCaptureController incase, but doesn't seem to make a difference.

What is the correct pattern to use for each of these?


1 Answer 1


EDIT: In the first version of the answer I forgot the /admin part of all the example URLs. Added now.

TL;DR version:

To get to the point first before explaining more in-depth: You need to convert the names from camelCase (with capitalisation in the name) to kebab-case (with dashes instead). I would suggest renaming your controller to simply DataCaptureController, since it's within the Gated Content plugin anyways, and you should be able to use:


Full answer:

So, the structure is basically plugin-name/controller-name/method-name, all in kebab case, meaning that what is someName should be some-name, as not all servers are case sensitive (althouth URLs technically are, if I'm correct). Also, the Controller and action parts of the class/method name is implied, as you've already correctly done, but as far as I know, not adding the plugin name to the front of your controller (I have not checked this specifically).

So in your case it should be something like this:


I am honestly not quite sure how underscores are treated in kebab-case, so it could be that this is the correct form:


Also, you should be able to use the url like this:


(Or, if you really prefer for some reason, with /actions in the URL:)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.