Call Joomla Plugin in Component in Easy Steps
Joomla content management system has different ways to call a plugin in components. This post covers the brief mechanism of Joomla plugin and how to call them in Joomla components.
Different Ways to Call Joomla Plugin in Component
In Joomla CMS, a plugin is not called the normal way. It is mostly triggered by events. Each time the event is triggered, the corresponding plugin is called. Inorder to call Joomla plugin in component each time, it must be triggered by one of the global system events. It is the safest way to call Joomla plugin in Joomla.
You can also call Joomla plugin in Component by the help of non-global system events. But in such cases, you have to explicitly add the event to each component for which the plugin is used.
Call an event defined in the plugin
$dispatcher = JDispatcher::getInstance(); $data = array($argu1, $argu2); // any number of arguments you want return $dispatcher->trigger($eventName, $data);
Call Content Plugins in Joomla Using
$text = JHTML::_('content.prepare', $text);