Joomla plugins work by subscribing to events. When the CMS fires an event, every plugin registered for that event group can run its handler.
Events are organised into groups. Official lists:
Creating a plugin
1. Installation (manifest) file
Writing a plugin starts with the installation XML file:
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8" type="plugin" group="search">
</extension>
Root element attributes:
| Attribute | Meaning |
|---|---|
version |
The Joomla version the plugin was developed for. |
type |
Extension type. For plugins this is always plugin. |
group |
The event group the plugin belongs to. |
Nested metadata elements:
<name>Hello world!</name>
<author>Andrew Dorokhov</author>
<creationDate>November 2018</creationDate>
<copyright>(C) 2018 Open Source Matters. All rights reserved.</copyright>
<license>GNU/GPL</license>
<authorEmail>andrew@dorohoff.net</authorEmail>
<authorUrl>dorohoff.net</authorUrl>
<version>2.0</version>
<description>Plugin description.</description>
| Element | Meaning |
|---|---|
name |
Plugin name. |
author |
Plugin author. |
creationDate |
Creation date. |
copyright |
Copyright notice. |
license |
License. |
authorEmail |
Author email. |
authorUrl |
Author website. |
version |
Plugin version. |
description |
Plugin description. |
Important nested elements — the files that make up the plugin:
<files>
<filename plugin="vouchsafe">vouchsafe.php</filename>
<filename>vouchsafe.xml</filename>
</files>
The plugin attribute on the main PHP file must match the plugin’s folder / file name. That is how Joomla knows which file is the entry point.
Andrew Dorokhov