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!

Related Questions

Getting Category’s custom fields in a blog view

1  Asked on September 5, 2021 by semaphore


How to post checkout data to component using Ajax?

1  Asked on September 5, 2021 by askerman


Display specific Joomla user groups

1  Asked on September 5, 2021 by niaziblog


how to get value for search in joomla module

1  Asked on September 5, 2021 by rhea-lorraine


Joomla installation on localhost using WAMP does not start

1  Asked on September 5, 2021 by bilal-kabeer-butt


Jquery script loaded on every page

1  Asked on September 5, 2021 by gag


category links don’t work

1  Asked on September 5, 2021 by giovanni-de-maria


Joomla 3.9 Child Sub Menu Not Showing

1  Asked on September 5, 2021 by ta1982


Trying to connect to an external ODBC data source

1  Asked on September 5, 2021 by irata


Can’t get a task to work from CLI

0  Asked on September 5, 2021 by tc0072


Ask a Question

Get help from others!

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