0

I have created a module the generates a form, validates submissions, saves the data in a table that the module creates on install and then integrates with a 3rd party system. This all works great but I would now like to add some settings to the module but there is no settings column for modules. So what would be the best way to add settings for the module that can changed in the control panel?

1

For modules, you just go ahead and create your own DB table that stores your module settings. So just like you create your modules main table for storing data submitted from your form when you install it, also create a table for your modules settings (something like exp_my_module_name_settings).

Follow the documentation for creating Control Panel pages for your module, and just create a form page that submits to itself (and have the method in the back-end update your settings table on POST).

https://docs.expressionengine.com/latest/development/modules.html#the-control-panel-file-mcpmodule_namephp

Yes, extensions have settings built into the the exp_extensions table, but they are meant to be simpler and just inject new logic via hooks. Modules are considered a whole new addition to your CMS, so think of a module more like a complete software package. You handle your module settings in its own table.

| improve this answer | |
  • Thanks, exactly was I was looking for. – Trevor Orr Jun 9 '19 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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