Skip to content

mod_articles_categories - Fatal error: Class 'ContentHelperRoute' not found in modules/mod_articles_categories/tmpl/default_items.php on line 14 #13588

@joomlabeat

Description

@joomlabeat

Steps to reproduce the issue

After updating a 3.4.8 site to 3.6.5 that uses mod_articles_categories I am getting a Fatal Error on the pages the module appears.
Class 'ContentHelperRoute' not found in modules/mod_articles_categories/tmpl/default_items.php on line 14

Just create a module instance to display the list of categories from one parent category and the error will occur.

Expected result

The module should display a list of categories from one parent category.

Actual result

Fatal Error

System information (as much as possible)

J 3.6.5

Additional comments

The problem is that the default_items.php is calling the ContentHelperRoute, which is not available.
The module has changed at some point from using require_once to load its helper.php and require_once to load the ContentHelperRoute Class inside the helper.php file, but now it loads the said Classes with JLoader::register();

But this way the ContentHelperRoute Class isn't available anymore in the template file.

The fix is to move the call
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

away from the helper.php

and put it in the mod_articles_categories.php

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions