I am working on a module to retrieve module parameters by ajax in helper.php :
$app = JFactory::getApplication();
$module = JModuleHelper::getModule('mod_mymodule');
$params = new JRegistry($module->params);
It works on single module on the page but if i have instance of module this method doesn't work and returns the parameter of other module as result!
so i tried using JModuleHelper::getModuleById($id);
and also
ModuleHelper::getModule('mod_mymodule','m1');
to solve the problem and point to specific instance of module. but none of them works on ajax function so i created a simulation to check the situation in a ajax function and normal function:
Creating module of type 'mod_mymodule' with name "m1"
creating 2 function in helper.php of module
function 1: render(); // function for testing
function 2: getbyajax(); // function to deal with ajax call.
i put following syntax in both functions:
$module = JModuleHelper::getModule('mod_mymodule','m1');
echo $module ->id;
both function must return the id of module!
function 1 works ;
function 2 doesn't works and render 0 as result;
Joomla 3.9.11
i also tested another function in both function ($id is the id of the module ).
$module = JModuleHelper::getModuleById($id);
echo $module->id;
the same result again! and first function is working but the ajax function doesn't work and returns 0
I think the joomla ajax can't detect correct instance of module.
Best
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-11-29 02:47:45 |
Closed_By | ⇒ | mbabker |
Labels |
Added:
000-CMS
|
Hi, this repository is for reporting bugs on the issue tracker itself. To report a bug on Joomla, please use https://github.com/joomla/joomla-cms/issues.