I'm trying to add a new event to getEvents() method in my plugin. To my surprise the method is not called. I suspect that Blesta caches the data somewhere as a part of a plugin installation process.
Am I right? Or am I missing something?
<?php
classMyPluginPluginextendsPlugin{...publicfunction getEvents(){// THIS METHOD IS NOT CALLED. I CHECKED BY ADDING A LOGGING STATEMENT HERE.return array(
array('event'=>"Appcontroller.preAction",'callback'=> array("this","run")),
array('event'=>"Another.event",'callback'=> array("this","anotherEvent")));}publicfunction run($event){// This will execute when the "Appcontroller.preAction" event is triggered}}?>
Question
MartyIX
Hola,
I'm trying to add a new event to getEvents() method in my plugin. To my surprise the method is not called. I suspect that Blesta caches the data somewhere as a part of a plugin installation process.
Am I right? Or am I missing something?
Thanks!
EDIT: I tried my idea with installation of the plugin and the method was really called. So that seems to be the culprit.
EDIT2: I could have just have a look at plugin_manager.php file...
EDIT3: This seems to work:
Event registration in /plugins/my_plugin_name/my_plugin_plugin.php (see http://docs.blesta.com/display/dev/Plugin+Events):
Sample controller /plugins/my_plugin_name/Controllers/InvoiceTester.php:
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.