Versions Compared

Key

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

...

Warning
titleThe EventObject is deprecated

Blesta v4.3.0 has deprecated and replaced the EventObject $event that is passed to your event callback. Plugins will still be passed an EventObject for backward compatibility, but this will be replaced by a \Blesta\Core\Util\Events\Common\EventInterface in the future, which supports the same methods and data. This means that your plugin implementation should not check for an EventObject type unless you also support a type check on \Blesta\Core\Util\Events\Common\EventInterface.

...

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

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

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

...