1 minute reading time (132 words)

How to access Joomla plugin parameters anywhere inside Joomla code?

How to access Joomla plugin parameters anywhere inside Joomla code?

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?

b2ap3_thumbnail_access-joomla-plugin-params.png

Here is a snippet of a Joomla code in PHP that lets you access plugin parameters anywhere inside Joomla.

// 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.

 

7
SocialAds v3.0.7.2 is out !
Next BIG thing in Smartphone & Desktop Apps is her...

Related Posts