When developing a new Joomla extension or making changes to existing extension, you might need to access plugin parameters of a Joomla plugin outside the plugin code. There can be cases where you want to access plugin parameters in some Joomla module or component. Now the question is - How to get plugin parameters outside the plugin code?
// Get plugin 'my_plugin' of plugin type 'my_plugin_type'
$plugin = JPluginHelper::getPlugin('my_plugin_type', 'my_plugin');
// Check if plugin is enabled
if ($plugin)
{
// Get plugin params
$pluginParams = new JRegistry($plugin->params);
$param1 = $pluginParams->get('param1');
$param2 = $pluginParams->get('param2');
$param3 = $pluginParams->get('param3');
}
Wasn’t that easy?
I hope this helps! Thanks for reading!
Feel free to add your comments.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.