Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a new module: basic steps?
#3
(11-28-2015, 09:45 AM)Guido1982 Wrote: I understand the vtlib module creation will auto-create tables and include the module name here. The only table I need is one where I can store the values in the settings page. Can I use the auto-created one for this? Or better to create table manually?

You can create a normal module with the fields you need and have the user configure the access as a new record, just like any other module. You could even add a preSaveCheck to avoid creating more than one record. That is the easy way.

If you want to do it in Settings (which is a little more in line with the application) you have to create your own Settings.php file in your module. Simply adding this file to your module will give it access to layout editor and workflows, if you modify it you can add your own entries and your own templates. The problem with this is that you have to manually do all the work, you have to create the table, setup the form, recover and edit all the data.

There are a few examples lying around but I will point you to the Payment module that has a simple example:

https://github.com/tsolucio/corebos/blob/master/modules/CobroPago/Settings.php#L68

(11-28-2015, 09:45 AM)Guido1982 Wrote: I'm guessing the TPL files for the settings page go in the same folder as normal TPL file templates, but how do I create a link in the settings page?

All templates for a new module go inside it's own template directory. For example for Payment module which is called CobroPago, you will have Smarty/templates/modules/CobroPago. When you create your module you create a "templates" directory and they will copied to the correct place during installation.

Look at the structure in some of the online modules:

https://github.com/tsolucio/Timecontrol
https://github.com/tsolucio/coreBOSPackingSlip

(11-28-2015, 09:45 AM)Guido1982 Wrote: What exactly are the modules' 'event handlers'? This seems like a workflow task?

I understand you are talking about the vtlib_handler() method. These are a set of events that are launched when installation related things happen. For example, when you install a module the module.postinstall event is launched so you can do some additional administration tasks. The most normal ones is to relate your new module with other modules in the system.
Joe
TSolucio
Reply


Messages In This Thread
RE: Creating a new module: basic steps? - joebordes - 11-28-2015, 03:55 PM

Forum Jump:


Users browsing this thread: 12 Guest(s)