Currently developing a module and a plugin (content) for a project that have some similar code in them (read: code for accessing APIs, organizing data, etc). Any environments that they're installed on will have both installed.

With that in mind, is there any way to call functions from the plugin's code via the module? Would like to shift as much of the codebase as possible to the plugin and just do calls from the module.

1 Answer 1


You firstly need to load your plugin group like so:

JPluginHelper::importPlugin('group', 'plugin_name');

You then need to call the JEventDispatcher class/instance like so:

$dispatcher = JEventDispatcher::getInstance();

Then, to trigger events:

$results = $dispatcher->trigger('onMyFunction', array(&$var1, &$var2));

This will called the onMyFunction in your plugin and pass $var1 and $var2. Your plugin can then manipulate these 2 variables (or as many as you like)

Hope this helps

  • I actually had tried that, but assumed it wasn't meant to work as imagined. Problem turned out to be that the methods I was trying to call were protected and not public. Stupid problem, but hey, it works. Cheers! Oct 20, 2015 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.