9
votes
Accepted
What is the current status of Joomla 4.x?
The development strategy for the Joomla CMS is currently being revised. There is going to be at least a 3.3 and a 3.4 and probably more incremental minor versions at irregular intervals. This is ...
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....
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 ...
4
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');
4
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
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 ...
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 ...
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 ...
3
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....
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\...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
2
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 = \...
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" ...
2
votes
Accepted
Fatal Error: Class 'ArticlesLatestHelper' not found in Joomla 4 module while trying to add new function
Either, include that helper class on the top of your default.php like:
defined('_JEXEC') or die;
use Joomla\Module\ArticlesLatest\Site\Helper\ArticlesLatestHelper;
Then you can use that class ...
2
votes
Update from 3.9.x to 4.x
Just an FYI that Joomla 3.10-alpha has now been released so the upgrade process can now easily done.
Instructions:
Go to the Joomla Update Component Options and switch the Update Channel to Testing ...
2
votes
Accepted
Updating JEventDispatcher triggers
use Joomla\CMS\Factory;
Factory::getApplication()->triggerEvent('onBeforeRenderToolbar', array($settings));
This method can be used in 3.x too.
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/...
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 ...
2
votes
Accepted
Joomla4 plugin getBody
According to the documentation, JApplicationWeb seems to be alive and well in Joomla4.
since 2.5.0
note As of 4.0 this class will be abstract
The getters:
JApplicationWeb::getBody()
Or
...
2
votes
Accepted
As JSubmenuHelper is deprecated, how to migrate to JHtmlSidebar?
You will firstly need to create a helper class that extends ContentHelper, like so:
administrator/components/com_mycomponent/Helper/MyComponentHelper.php
use Joomla\CMS\Helper\ContentHelper;
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
joomla-4.x × 147joomla-4 × 20
joomla-3.x × 14
php × 14
custom-component × 11
custom-field × 11
component × 8
javascript × 8
plugin × 7
extensions × 7
articles × 6
joomla-api × 6
html × 6
module × 5
administrator × 5
restful-api × 5
mysql × 4
ajax × 4
form-fields-types × 4
sql × 4
router × 4
namespace × 4
templates × 3
css × 3
database × 3