Plugins provide ways of adding functionality to Elgg. This can be as little as a WYSIWYG text editor, or as much as a full feature like a blog or a photo gallery.
Contents |
Every Elgg plugin sits in a subdirectory of the /mod folder and contains a PHP script called start.php. The name of your subdirectory is your plugin name, so choose carefully! It should be unique but readable, so that site administrators don't accidentally overwrite it with another plugin, but they can also understand at a glance what your plugin does.
Your plugin may have a set of views (see the views reference for plugin-specific information). These may overwrite or extend existing system views.
If you're outputting any system (as opposed to user-entered) text to the screen, we strongly recommend internationalizing using the built-in internationalization functions. See the plugin reference here.
The start.php file is the control hub of any plugin.
We recommend that you create a yourplugin_init function, responsible for setting up page handling, submenu items and so on during Elgg's init event. (Read more about events here.) You can do this by declaring:
register_elgg_event_handler('init','system','yourplugin_init');
Within this you can add calls to define the overall behaviour of your plugin.