I'm testing and playing with Joomla 4 alpha. What I tried to do is to quick-edit / modify the module Latest Article (mod_articles_latest), adding a new function.

In joomla 3.x I usually adding a new function to a module by adding it to helper.php file like this :

class ModNameHelper
    public static function myFunctionName($param1,$param2)
    { ...

Then I call it from the default.php like this:


Now I tried to duplicate these steps with mod_articles_latest by adding myCustomFunction to ArticlesLatestHelper.php like this :

 * @package     Joomla.Site
 * @subpackage  mod_articles_latest
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt

namespace Joomla\Module\ArticlesLatest\Site\Helper;

defined('_JEXEC') or die;

use Joomla\CMS\Access\Access;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Model\ArticlesModel;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

\JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

 * Helper for mod_articles_latest
 * @since  1.6
abstract class ArticlesLatestHelper
     * Retrieve a list of article
     * @param   Registry       $params  The module parameters.
     * @param   ArticlesModel  $model   The model.
     * @return  mixed
     * @since   1.6
    public static function getList(Registry $params, ArticlesModel $model)
    { // this is the built-in function ... }

    public static function myCustomFunction($myparam) {

and then called the function in the default.php like this


But it returned fatal error :

Error: Class 'ArticlesLatestHelper' not found: Class 'ArticlesLatestHelper' not found

Can anybody tell me, what am I doing wrong in here? Thanks!

1 Answer 1


Either, include that helper class on the top of your default.php like:

defined('_JEXEC') or die;

use Joomla\Module\ArticlesLatest\Site\Helper\ArticlesLatestHelper;

Then you can use that class within your default.php file

Or standardly define your own variable in mod_articles_latest.php like:

$myStuffHere = ArticlesLatestHelper::myCustomFunction($myparam);

And then you can use the returned values of $myStuffHere with that variable name in default.php

I think this is what you are looking for.


Your Answer

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

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