Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Some plugins may need to be invoked to perform certain tasks immediately before or after an action has occurred. For this reason plugins may register plugin events. These Events automatically initialize the plugin and invoke the desired callback method when triggered. The parameters passed to the callback method vary depending on the event invokedAll callback event methods accept a single EventObject parameter.

For performing tasks at regular intervals see Plugin Cron Tasks.

...

Code Block
languagephp
title/plugins/my_plugin/my_plugin_plugin.php
<?php
class MyPluginPlugin extends Plugin {

	...

	public function getEvents() {
		return array(
			array(
				'event' => "preactionAppcontroller.preAction",
				'callback' => array("this", "run")
			)
			// Add multiple events here
		);
	}

	public function run($event) {
		// This will execute when the "preactionAppcontroller.preAction" event is triggered
	}
}
?>

...