fevangelou
8/30/2018 - 2:37 PM

How to access Joomla plugin parameters anywhere in Joomla

How to access Joomla plugin parameters anywhere in Joomla

<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

// === How to access Joomla plugin parameters anywhere in Joomla ===

// Get plugin with name 'plugin_name' of type 'plugin_type' (e.g. "content")
$plugin = JPluginHelper::getPlugin('plugin_type', 'plugin_name');

// Check if the plugin exists and is enabled
if ($plugin) {
    // Call plugin params
    $pluginParams = new JRegistry($plugin->params);

    // Retrieve plugin params
    $param1 = $pluginParams->get('param1');
    $param2 = $pluginParams->get('param2');
    $param3 = $pluginParams->get('param3');
}