Documentation

Working with Addons/Modules/Views

Creating a module

Modules are objects that can be used in and outside of the addon object they are attached to. They are provided as a convenience to let you structure your code better than having all the code constrained within the addon object.
Each addon can have an unlimited number of modules.
Example of module class:

/* Restrict direct access to this file */ defined('TK_EXEC') or die('Restricted area.'); class backend_module extends module { public function __construct($attr, $id_addon, $config, $log, $language) { parent::__construct($attr, $id_addon, $config, $log, $language); } }

In this example, 'backend' is the module name.

All module names must be suffixed with '_module'.

We could define several modules, possibly with similar interfaces to make our life easier when developing the addon.
For example, we could have a 'backend' and a 'frontend' module.

As for the addon themselves, any module object can be extended in a similar way.
For example:

class backend_ext_module extends backend_module {}

As in the addon case, this makes sense when the module itself is defined at the framework level and the extension is defined at the application level.