This is a translation of the original English documentation page. Help us make it better.

Modules

What is a PHP frontend module?

  • A module is an entity with a unique ID, name, description, author, and other fields defined in it's manifest file, along with PHP, Javascript and other files located under a single subdirectory of /ui/modules.
  • A module should conform to simple rules to guarantee correct operation.
  • A module must be installed (unpacked) and enabled in the frontend by the administrator.

What a module can be used for

  • Adding new functionality via custom frontend sections;
  • Creating custom dashboard widget types (see widget modules);
  • Overriding or extending the existing functionality.

What a module cannot be used for

  • Registering a new API method or modifying an existing one.

How modules work

  • An enabled module is launched on each HTTP request, before executing the action code.
  • The module will register new actions or redefine the existing ones.
  • The module will add new frontend sections and remove or redefine the existing ones.
  • The module will hook to frontend events like onBeforeAction and onTerminate, if needed.
  • The requested action is finally executed by running the action code - either the default one, or module-defined.

Where to go next

Whether you prefer to learn by doing or read the guidelines first, these pages contain the information and steps required to build your own modules: