As I understand, to use Joomla! plugin events from my user code, I first need to load the plugin class (which registers the named functions as events in the event dispatcher):
JPluginHelper::importPlugin('captcha');
Then I can trigger events from my user code:
$dispatcher = JDispatcher::getInstance();
trigger('onInit');
How does the plugin system handle name collisions between events? For example, the captcha
plugins have an onDisplay
function/event, as do the editor
plugins. What happens when I call the following after the previous code?
JPluginHelper::importPlugin('editor');
trigger('onDisplay');
I believe this will trigger the onDisplay
event on both the group of captcha
plugins, and the group of editor
plugins. It seems like the trigger
method of JEventDispatcher
would need a parameter for at least the group of plugins to act on. Do I get all plugins with an onDisplay
function firing, and I have to sort out what is garbage? What if a non-relevant plugin running with garbage input has an exception on that input?