5 votes

JFactory::getDbo() deprecated-- what's the replacement?

Joomla 3.9.x has a file public_html/libraries/classmap.php that contains all the old style Class names, and the new replacements. E.g. JLoader::registerAlias('JFactory', '\\Joomla\\CMS\\Factory', '5....
  • 1,533
5 votes

JFactory::getDbo() deprecated-- what's the replacement?

If you are developing your extension only for Joomla 4.0+, you can replace $db = Factory::getDbo(); with $db = Factory::getContainer()->get('DatabaseDriver');
5 votes
Accepted

How to use HTMLHelper to add to the document head

1) JHtml is an alias for Joomla\CMS\HTML\HTMLHelper class. You'll have to start using the real class sooner or later because the alias will not exist in Joomla! 5.0. To use the real class you have to ...
  • 8,776
5 votes
Accepted

Joomla extension update 3.x and 4.x

Based on this link that Roland Dalmulder sent me to: https://github.com/joomla/joomla-cms/blob/5fdba4e5ee022517a05ae893d8f7077eaf864bf7/libraries/src/Updater/Adapter/ExtensionAdapter.php#L113 ...
  • 4,493
4 votes
Accepted

Update from 3.9.x to 4.x

You need to wait for 3.10.X to become available; as per the documentation, "This guide assumes you are starting on Joomla 3.10.x. If you are on a earlier version make sure you upgrade to Joomla 3....
  • 704
4 votes
Accepted

Best Practice: Loading component Styles & Scripts in J4

Both have pros and cons. Web Asset Manager is great if your loading an asset that depends on another one. For example: some jQuery plugin that depends on jQuery Your json file can set jQuery as a ...
  • 26.5k
4 votes
Accepted

Is Joomla4 API/Web Service ready for production use?

You can download the full API collection here: https://github.com/alexandreelise/j4x-api-collection thanks to Alexandre Elise. This will import directly into Postman which will enable you to use the ...
  • 1,839
4 votes

Is the following everything one should do to prevent SQL injection?

First, when reading user input you should make sure it's the correct type. The Input/Filter APIs don't handle array/string conversion. So if you're expecting STRING filter to return a string be aware ...
  • 8,776
4 votes

How to create a (better) development environment for Joomla 4

I've not used Docker so I can't help with that, but I have xdebug set up on my local environment in combination with PHPStorm and that is a big help in enabling me to figure out why something's not ...
3 votes
Accepted

Proper way for autoloading in Joomla 4

This should still work in 4.0 but will break in 5.0. You are advised to use fully qualified class names. Remove JLoader::register() call and instead add a use statement: use Joomla\Component\Fields\...
  • 8,776
3 votes
Accepted

Class not found in Joomla 4 when using JDate inside a function

I’m answering the question because it is obviously not a Joomla 4 core bug but a mistake in the developer’s coding and the problem would be the same in Joomla 3 too. If you try to use a Joomla core ...
  • 2,436
3 votes
Accepted

Joomla 4 alpha mootools library

In Joomla 4 we've completely removed the Mootools library and any API functions for it. If you'd like to utilise a modal, you can use JHtmlBootstrap::renderModal which is currently a wrapper for ...
  • 26.5k
3 votes

Menu Model Item in Joomla 4

To get Menu item in Joomla 4 you can get the Item From the Factory like use Joomla\CMS\Factory; $menu = Factory::getApplication()->getMenu(); $active = $menu->getActive(); getActive() will ...
  • 486
3 votes
Accepted

Where are plugins found in Joomla 4?

You probably work with Joomla 4 (alpha) as beta does not seem to be yet available. The plugins in Joomla 4 (alpha 7 latest) are at administrator->system->manage->plugins.
  • 2,436
3 votes
Accepted

Get Framework and template params in Joomla 4

define('_JEXEC', 1); define('JPATH_BASE', __DIR__ . '/../../..'); require JPATH_BASE . '/includes/defines.php'; require JPATH_BASE . '/includes/framework.php'; // Boot the DI container. $container = \...
  • 8,776
3 votes
Accepted

JFactory::getDbo() deprecated-- what's the replacement?

Your issue comes solely from confusion about Joomla! versions. These facts should clear the air: \Joomla\CMS\Factory::getDbo() is deprecated in 4.0 and will be removed in 5.0. It is alive and well in ...
  • 8,776
3 votes
Accepted

'JModuleHelper' is deprecated in Joomla 4 and what is its equivalent

Use the fully qualified class name which is Joomla\CMS\Helper\ModuleHelper. To get this information in your IDE, you can run build/stubGenerator.php script via PHP command line. This will generate a ...
  • 8,776
3 votes

'getErrorMsg' is deprecated in Joomla 4 and what would be the equivalent

I try to give just a short answer on this. We cannot say that there is an “equivalent” of your code snippet in Joomla 4 since Joomla has been handling errors with using core PHP Exceptions. And your ...
  • 2,436
3 votes

How does Joomla 4 decide a component is legacy?

Any component that is an instance of Joomla\CMS\Extension\LegacyComponent. This includes: J3 style components that do not have services/provider.php file returning a service provider. J4 components ...
  • 8,776
3 votes
Accepted

Creating a field plug-in, need the com_content form to be enctype multipart

There really isn't a good way to do this. Your best bet is parsing the already generated HTML and making a replacement there. For the component this can be done using onAfterDispatch event. Below is a ...
  • 8,776
3 votes

jQuery scripts not working in Joomla 4 template

Yes, for the most part J4 uses vanilla JavaScript and dependencies like jQuery should be loaded only when needed. If it's needed by your template's script files, you can add it as dependency in your ...
  • 8,776
3 votes

Joomla 4 API Question

Academic explanation of J! 4 webservices route mapping This is an explanation of how Joomla 4 (hereafter referred to as J! 4) webservices route resolution and method finding works. Disclaimer What ...
3 votes
Accepted

Joomla 4 create article programmatically

I rewrote the "Content Uploader" for Joomla 4 because I couldn't reach the developer. I had exactly the same problem as you described in the first example. The reason is that the Workflow ...
3 votes

Joomla 4 create article programmatically

This will work. $newapp = JFactory::getApplication(); $mvcFactory = $newapp->bootComponent('com_content')->getMVCFactory(); $articleModel = $mvcFactory->createModel('Article', 'Administrator',...
3 votes
Accepted

Joomla upgrade: 3.10.11 to 4.x

The issue turned out to be the extension RSFirewall for Joomla By RSJoomla. To solve the issue I added an 'exception'. I specified that the component named 'Joomla! Update' could bypass all aspects of ...
  • 351
3 votes

How can I remove front-end Edit button from side menus?

In System -> Global Configuration -> Site -> Frontend Editing you have the choice of: Modules & Menus Modules None
2 votes

JFactory::getDbo() deprecated-- what's the replacement?

Your comment led me to doubt my belief that getDbo() is alive and well. I have tested my below techniques on Joomla3.9.5 and there are no problems. Original answer... Based on this documentation: ...
  • 4,493
2 votes

Replacing JSubmenuHelper with JHtmlSidebar / Administrative menu in Joomla 4

Finally figured it out - my problem is a missing placeholder in the tmpl (which was not required for JSubMenuHelper). Added this to my tmpl/default.php, now it works: <div id="j-sidebar-container" ...
  • 161
2 votes
Accepted

How to use cache calls in Joomla 4

The call method has been marked as removed for Joomla 4.0, as it's simply a wrapper for get(). You don't need to manually store the cache as this is done within the get() method: https://github.com/...
  • 26.5k
2 votes
Accepted

Joomla 4 - how to set namespace for custom field addfieldprefix

To implement Joomla standard namespacing in a plugin, follow these steps: First, declare extension's namespace in manifest file: <namespace>Joomla\Plugin\EditorsXtd\Vimeo</namespace> If ...
  • 8,776

Only top scored, non community-wiki answers of a minimum length are eligible