How to migrate old J prefix classes to new Joomla classes

I am trying to migrating old classes names to the new ones available on classmap.php

However after renaming the classes I am having these errors:

Class 'Text' not found //JText works

Class 'BaseController' not found //JControllerLegacy works

I am new to joomla but for my understanding I only need joomla 3.x, which I am running.

Am I missing some import?

Joomla Asked by Exprove on December 26, 2020

1 Answers

One Answer

You need to specify the namespace before you use them, so for your examples above:

use JoomlaCMSLanguageText;
use JoomlaCMSMVCControllerBaseController;

class YourClass extends BaseController {
    echo Text::_('YOUR_CONSTANT');

Otherwise, you can do it like this, which is going to get tedious pretty quick:

class YourClass extends JoomlaCMSMVCControllerBaseController {
    echo JoomlaCMSLanguageText::_('YOUR_CONSTANT');

Answered by Grant G on December 26, 2020

Add your own answers!

Related Questions

Generating a module instance from PHP

0  Asked on September 5, 2021 by ffrewin


Embed custom JS app in Joomla MVC

0  Asked on September 5, 2021 by miasto


Error when updating Gantry from 4.1.20 to 4.1.32

1  Asked on September 5, 2021 by norberto-gomes


Change user permissions programmatically on the fly

1  Asked on September 5, 2021 by aheavyobject


Akeeba backup update broke the site

2  Asked on September 5, 2021 by hamlet-kraskian


Proper way for autoloading in Joomla 4

1  Asked on September 5, 2021 by webchun


Menu Specifically For Super Users

1  Asked on September 5, 2021


Joomla PHP does not match host PHP

2  Asked on February 18, 2021


Controller Joomla – Output Class construct for color css style

1  Asked on February 5, 2021 by andrea-suriani


Joomla custom component – router not find alias

1  Asked on January 21, 2021 by lecraver


Joomla 3 call model function inside controller

3  Asked on December 28, 2020 by wbdevlop


Product url problem after updating VirtueMart

1  Asked on December 23, 2020 by kiasaty


Display intro image inside mod_breadcrumbs

0  Asked on November 11, 2020 by geoplous


Ask a Question

Get help from others!

© 2022 All rights reserved.