In Joomla, Module configurations are stored as Module parameters. Typically you only need to use parameters in the module itself. However, sometimes you might need to access them from other places like your component or a plugin. And this can get especially tricky when you have multiple copies of the module.
A live case example for this is SocialAds Modules. In this case we need to know in places other than the module itself what parameters each copy of the SocialAds module is configured with.
This blog will show you how you can do this.
Note: This Blog is purely targeted towards developers!
In the case above, we have a SocialAds module that lets you configure the zone from which Ads should be picked up. You can create multiple copies of the module and configure each differently. However we don't run the code for all this in the module for efficiency reasons. Here is how you can get the module id for each module and pass it to your common function. You can use the subsequent code to get the module params.
// Take a module id $moduleId = $module->id; //Pass module id to a function functionName($params, $moduleId);
jimport( 'joomla.application.module.helper' ); // For example Module_Name is login $module = JModuleHelper::getModule(‘ Modul_Name’ ); echo '
'; print_r( $module ); echo '
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.