Anatomy of a module
- Home
- Developing modules
- Anatomy of a module
Modules have a directory structure which mirror the sub-namespaces of the module:
- Controllers - front-end controllers
- Controllers/Admin - admin controllers
- Helpers - helper classes
- Widgets - classes for widgets (content blocks)
Additional directories can be created as required, including sub-directories, as long as the directory names match the corresponding namespace, including the use of leading capital letters.
There are also some directories which don't correspond to a namespace. These directories do not have a leading capital letter in their name.
- config - default/example configuration files which should be copied to the top-level config directory when they're modified
- media - module specific javascript and css files
- tests - PHPUnit tests for this module
- views - admin and front-end views for the module
There are also a few files which reside directly within the module directory:
- sprout_load.php - included in all requests, for registration; see initialisation/registration
- admin_load.php - included for all admin requests, for registration; see initialisation/registration
- db_struct.xml - Database table definitions; see database tables