Search
Other Advanced Module Manager questions
Forum

This extension is not assuming Factory::getApplication() in Joomla 4, but JFactory instead

Rogerio Brito's Avatar Rogerio Brito
Hello.
I am using the following code in Joomla 4 (php option) for the Adanced Modules Manager:
$jinput = Factory::getApplication()->input;
$view = $jinput->get('view');

if($view == 'norma'){
 return true;
} else {
  return false;
}

Expected result: return my conditions
Real result: class Factory is not found
Workaround: JFactory is working in it, but this can be a problem in future Joomla updates.

Can you add corrections to accept Joomla 4 codes?
Peter van Westen's Avatar Peter van Westen ADMIN
You can simply do:
return $app->input->get('view') == 'norma';
Please post a rating at the Joomla! Extensions Directory
Rogerio Brito's Avatar Rogerio Brito
Oh, excelent!
This solves this question for me in a good way!
Thank you!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription