简体   繁体   中英

Trigger Plugin from model - Joomla

I created a custom plugin for my joomla extension, it all works well while trying to trigger it from a template override (just for test). But when I try to fire it from the extension model (the same code that works in the override) it doesn't trigger the event.

Is there anything specific that needs to be done to the extension to be able to trigger it from the model?

here is what I am using and works in the template override but doesn't work in the model

JPluginHelper::importPlugin('bookingnotification');
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onHelloWorld', array());

I am clueless

I found the answer to own my question. For some reason if I am triggering the event from a template override I can specify only the plugin folder in the importPlugin, like below

JPluginHelper::importPlugin('bookingnotification');

But if I am triggering it from the model it will only work (or at least in my case) if I specify the the group and the plugin folders, like below

 JPluginHelper::importPlugin('user','bookingnotification');

I hope this helps some else

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM