class plgSystemExample extends JPlugin { public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); $this->pluginName = 'Example Plugin'; $this->pluginVersion = '1.0'; } }
class plgContentExample extends JPlugin { public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); $this->registerEvent('onContentBeforeSave', 'onContentBeforeSaveExample'); } public function onContentBeforeSaveExample($context, &$article, $isNew) { // Custom code to modify the article before saving } }In this example, the __construct method is used to register a plugin event (onContentBeforeSave) and associate it with a custom method (onContentBeforeSaveExample). When the event is triggered by Joomla!, the onContentBeforeSaveExample method will be called to perform any custom logic required. Package library: Joomla! CMS