2

My phpstorm reports that the following is deprecated:

$app      = Factory::getApplication();
$sitename = $app->getCfg('sitename');

What is the new correct way to go for this in Joomla 4 ?

2 Answers2

1

We can fix this using 2 methods,

Method 1:

use Joomla\CMS\Factory;  
$app = Factory::getApplication();  
$sitename = $app->getCfg('sitename');

Method 2:

$app = JFactory::getApplication();  
$sitename = $app->getCfg('sitename');
Mohammed Nagoor
  • 884
  • 2
  • 12
  • 25
0

You can simply do:

$sitename = $app->get('sitename')