newcomer developing joomla component

184 views
Skip to first unread message

John Curious

unread,
Aug 14, 2018, 7:48:23 AM8/14/18
to Joomla! General Development
Hi,
I'm a newcomer in the world of joomla, have experience with php for a good while.
I have some books on developing joomla comoponents and extensions / plugins, but most of the source code examples I find online are using the legacy classes..
Where can I find a good reference on the major code differences (the api is not so helpful as to which classes became which ones ... .i.e. I am extending HtmlList instead of a ...Legacy class ... can't seem to figure out more info on this transition). I have looked everywhere and all the joomla docs are outlining from a user's point of view. 
Also, I seem to understand that once Joomla hits 4.x the Legacy classes will be discarded and I don't want to find myself in the position of a major rewrite.
A little bit of guidelines for a newcomer arriving amidst Joomla scene during these times and needing to develop a component would be much appreciated.

John Curious

unread,
Aug 14, 2018, 7:54:39 AM8/14/18
to Joomla! General Development
For instance in looking upon joomla naming conventions, it says that the controller should extend the class JController but I have found a lot of code that extends AdminController. 
And other difference is they use ..\..\...\AdminController instead of jimporting ...

Glenn Arkell

unread,
Aug 14, 2018, 11:31:50 PM8/14/18
to Joomla! General Development
Hi John, I'm in the process of rewriting my components etc using the "namespace" classes etc and these are all displayed at https://api.joomla.org/cms-3/namespaces/Joomla.html.
Now I may not be doing things correctly so just take this on board and hopefully someone will correct me if wrong.

In my admin controller.php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;

class MycomponentController extends BaseController
{ . . . .


Then throughout my coding I have referred to these "use" classes.

eg
use Joomla\CMS\Factory;

Factory::getApplication()->input->set('view', $view);

Now I have noticed in some of the core components I see Factory prefixed with a \ but my components are working fine without these in 3.8.11 anyway. The list below is what I've used so far.  Hope this helps.  Cheers.

Glenn

use Joomla\CMS\Component\Router\RouterBase;    //in the component router (site)
use Joomla\CMS\MVC\Controller\BaseController;  // in the component controller (site)
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Installer;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\MVC\Model\FormModel;
use Joomla\CMS\MVC\Model\ItemModel;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Helper\TagsHelper;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\User\UserHelper;
use Joomla\CMS\Access\Access;
use Joomla\Data\DataObject;
use Joomla\Utilities\ArrayHelper;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
use Joomla\Filesystem\Path;
use Joomla\Registry\Registry;

John Curious

unread,
Aug 14, 2018, 11:55:07 PM8/14/18
to Joomla! General Development
wow. Thank you so much for your answer. This is just what I was looking for. I'm still having trouble figuring how to rename from old to new in some cases but this helps a lot.

Now another thing,

chris.r...@gmail.com

unread,
Sep 18, 2018, 3:54:45 AM9/18/18
to Joomla! General Development
check out \libraries\classmap.php ; you will find a catalog there; like so:

You'll be doing yourself a favor by using the new names (the right columns)

JLoader::registerAlias('JApplicationAdministrator',         '\\Joomla\\CMS\\Application\\AdministratorApplication', '5.0');
JLoader::registerAlias('JApplicationHelper',                '\\Joomla\\CMS\\Application\\ApplicationHelper', '5.0');
JLoader::registerAlias('JApplicationBase',                  '\\Joomla\\CMS\\Application\\BaseApplication', '5.0');
JLoader::registerAlias('JApplicationCli',                   '\\Joomla\\CMS\\Application\\CliApplication', '5.0');
JLoader::registerAlias('JApplicationCms',                   '\\Joomla\\CMS\\Application\\CMSApplication', '5.0');
JLoader::registerAlias('JApplicationDaemon',                '\\Joomla\\CMS\\Application\\DaemonApplication', '5.0');
JLoader::registerAlias('JApplicationSite',                  '\\Joomla\\CMS\\Application\\SiteApplication', '5.0');
JLoader::registerAlias('JApplicationWeb',                   '\\Joomla\\CMS\\Application\\WebApplication', '5.0');
JLoader::registerAlias('JApplicationWebClient',             '\\Joomla\\Application\\Web\\WebClient', '5.0');
JLoader::registerAlias('JDaemon',                           '\\Joomla\\CMS\\Application\\DaemonApplication', '5.0');
JLoader::registerAlias('JCli',                              '\\Joomla\\CMS\\Application\\CliApplication', '5.0');
JLoader::registerAlias('JWeb',                              '\\Joomla\\CMS\\Application\\WebApplication', '4.0');
JLoader::registerAlias('JWebClient',                        '\\Joomla\\Application\\Web\\WebClient', '4.0');



Reply all
Reply to author
Forward
0 new messages