diff options
Diffstat (limited to 'app/Core/PluginBase.php')
-rw-r--r-- | app/Core/PluginBase.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/Core/PluginBase.php b/app/Core/PluginBase.php index 9c3d6e32..457afa03 100644 --- a/app/Core/PluginBase.php +++ b/app/Core/PluginBase.php @@ -28,4 +28,20 @@ abstract class PluginBase extends Base { return array(); } + + /** + * Listen on internal events + * + * @access public + * @param string $event + * @param callable $callback + */ + public function on($event, $callback) + { + $container = $this->container; + + $this->container['dispatcher']->addListener($event, function() use ($container, $callback) { + call_user_func($callback, $container); + }); + } } |