-
Notifications
You must be signed in to change notification settings - Fork 50
Module system
Chris Murray edited this page Nov 26, 2013
·
3 revisions
SetlzerCRM can be extended through its module system.
The basic steps to create a module are:
- Create a php file. For example, create foo.inc.php if your module is called "foo".
- Add a function "<module name>_revision()" to the file (eg. "foo_revision()"). For a new module, it should return 1.
- Add a function "<module name>_install($old_revision)" (eg. "foo_install()"). This function should run any database installation code if $old_revision is 0.
- Optionally add an init function "<module name>_init()" to be called when the module is loaded (eg. "foo_init()").
- Add any data, table, form, and theme functions.
- Place your file in the crm/modules/<module_name>/ directory (eg. crm/modules/foo/).
- Add your module to the $config_modules array in config.inc.php. Make sure to add it after any modules it depends on.
- Modify <module name>_revision() to return a the number one higher than the previous version.
- If changes are required to the database, add the code to make those changes to the end of <module_name>_install($old_revision). They should only be run if $old_revision is less than the revision number returned by <module name>_revision().
- Visit the upgrade tab to run your installation code.
- Make any other changes to the code.