TransWikia.com

How to migrate old J prefix classes to new Joomla classes

Joomla Asked by Exprove on December 26, 2020

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?

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP