My code

use Joomla\CMS\Language\Text;

use Joomla\CMS\Access\Access;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
use Joomla\Component\Content\Site\Helper\RouteHelper;

\defined('_JEXEC') or die;

$app = Factory::getApplication('Site');

// Get an instance of the generic articles model
$model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Site', ['ignore_request' => true]);
$appParams = $app->getParams();
$model->setState('params', $appParams);
$model->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
$items = $model->getItems();

The first error in the line

$appParams = $app->getParams();

Call to undefined method Joomla\CMS\Application\AdministratorApplication::getParams()

The second error in the line

$items = $model->getItems();

Call to a member function get() on null

1 () JROOT\components\com_content\src\Model\ArticlesModel.php:273

2 Joomla\Component\Content\Site\Model\ArticlesModel->getListQuery() JROOT\libraries\src\MVC\Model\ListModel.php:215

3 Joomla\CMS\MVC\Model\ListModel->_getListQuery() JROOT\libraries\src\MVC\Model\ListModel.php:264

4 Joomla\CMS\MVC\Model\ListModel->getItems() JROOT\components\com_content\src\Model\ArticlesModel.php:640

5 Joomla\Component\Content\Site\Model\ArticlesModel->getItems() JROOT\administrator\modules\mod_antajaxrequest\articlelist.php:21

Tell me how to get a list of site articles in the administrative panel, in the module parameters? Thank you.

1 Answer 1


Joomla\CMS\Factory::getApplication() no longer takes any arguments. It always return the active application instance. Joomla\CMS\Application\AdministratorApplication doesn't have a getParams() method so that's where the error comes. If really needed, you can get the site application from the service container:


Using application within application, however, is a bad practice and won't work correctly most of the time. In your case you don't really need this anyways - params from site application are request-specific and will not work correctly in backend. Essentially SiteApplication::getParams() is used to merge component params with active menu item params, which are not relevant when running this code in backend or generally when the request is ignored using ignore_request option. So you can pass just the component params:

$model->setState('params', clone ComponentHelper::getParams('com_content'));

Another option would be to, of course, use the backend model instead. It will return the same articles but without running any code that is relevant only to frontend.

  • Thanks for the answer. Tell me - how to correctly get a list of site articles with pagination in the administrative part? Thank you.
    – antarey
    Dec 23, 2022 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.