As of May 31, 2023, we have updated our Code of Conduct.
7 votes
Accepted

How to use joomla.asset.json correctly?

To your first question "how can I make Joomla acknowledge my joomla.asset.json changes without reinstalling extensions?" I think it is not right that you have to reinstall the extension ...
astridx's user avatar
  • 394
7 votes

Loading the built-in jQuery in Joomla 4 if it does not exist

You should be able to load it like so: Joomla\CMS\HTML\HTMLHelper::_('jquery.framework'); Else, if you're using Joomla's Web Asset Manager, then you can define it as a dependency in your JSON object: ...
Lodder's user avatar
  • 26.8k
6 votes
Accepted

What is the best way for raising an error message in Joomla 4

In #1 the first line of the first method will output a message to the next page that is displayed to user after the processing has completed so this is a nice simple way to inform that user that they ...
Irata's user avatar
  • 3,057
5 votes

New files in Joomla 4 components

An excellent resource for Joomla 4 extension development is "Joomla 4.x Tutorial - Extension Development - The Way to Joomla 4 Extensions" written by Astrid Günther: https://blog.astrid-...
pe7er's user avatar
  • 1,803
5 votes
Accepted

New files in Joomla 4 components

services/provider.php should return a service provider which is used to register services with the service container and set up initial dependencies. This is the only file with a hardcoded filename ...
Sharky's user avatar
  • 9,936
4 votes

Non deprecated method in Joomla! 4 to load user by userid

Use Joomla\CMS\User\UserFactory. You can get it from the service container: use Joomla\CMS\User\UserFactoryInterface; $userFactory = $container->get(UserFactoryInterface::class); Or using alias: $...
Sharky's user avatar
  • 9,936
4 votes
Accepted

How to override a form field in Joomla 4

Apparently, you need to use namespaces in your extension to override fields with the same type. This is because of the class lookup order: Namespaces added using addfieldprefix attribute or Joomla\...
Sharky's user avatar
  • 9,936
4 votes

SQL syntax error in query with subquery using JDatabase

to spot a sql syntax error it's useful to view the resultant sql eg. echo $query->__toString(); you've put the alias of the subquery 'b' as the alias of the table inside the subquery. But the ...
jamesgarrett's user avatar
  • 3,269
4 votes
Accepted

language file naming conventions

Use non-prefixed filenames in J4 (3.10 also supports this). Nothing is stripping the prefix, some core manifest files just haven't been updated.
Sharky's user avatar
  • 9,936
4 votes

Joomla 4 Smart Search: Extra database for indexing data

Some big sites use external indexing software / services to index and search their site. Some are available as Software as a Service, while others can be installed on your own resources. For Joomla 4 ...
pe7er's user avatar
  • 1,803
3 votes
Accepted

In controller in admin of my component, i want to load a model from com_plugins

Yes, Joomla4 has a different approach. This is how you can call other component's Model: use Joomla\CMS\Factory; $app = Factory::getApplication(); $model = $app->bootComponent('com_plugins')->...
Zollie's user avatar
  • 2,846
3 votes

Install Script - J3 to J4

Q1 - In J4 I found that this simple function gets what you might want: /** * Get the version of the component * @return version element of manifest */ public static function getComponentVersion() { ...
Glenn Arkell's user avatar
3 votes
Accepted

Is there a resource showing all the J3 classes mapped to the J4 equivalents?

You can find the equivalent of Joomla! classes here: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/classmap.php Your IDE will show when a method is deprecated in your code if you set ...
user3533235's user avatar
3 votes
Accepted

Send error or exception returned from ajax request to enqueuemessage

When you say "display it into enqueuemessage" I'm assuming that you want to display it in the same message area that enqueueMessage displays in. You can do that in your javascript by calling Joomla....
Robbie Jackson's user avatar
3 votes
Accepted

Joomla 4 alpha - link to dialog file in editor-xtd broken

You should try to define the path with using Constants: $button->set('link', JPATH_ROOT . '/plugins/editors-xtd/insertmystuff/insert_mystuff/mystuffplugin_dialog.php?e_name=' . $name); or: $...
Zollie's user avatar
  • 2,846
3 votes

Joomla 4 no longer inserting the Itemid, the current or active menu , in the URL. Is this correct behavior?

In Joomla 4 the /library/src/Router/SiteRouter.php has a new method, buildInit, that replaces the createInit method of Joomla 3. In appearance they do the same thing, suffix the URL with the Itemid=(...
Irata's user avatar
  • 3,057
3 votes
Accepted

Loading the built-in jQuery in Joomla 4 if it does not exist

Lodder answer is certainly useful, but not what I wanted to see. The correct loading of the embedded jquery looks like this. use Joomla\CMS\Factory; $wa = Factory::getApplication()->getDocument()-&...
MaXX's user avatar
  • 141
3 votes
Accepted

Loading a helper file in Joomla 4

JLoader::register() call should include fully qualified class name. In your case it's Myhelper\MyHelper: JLoader::register('Myhelper\Myhelper', 'templates/mytemplate/html/helper.php'); The class also ...
Sharky's user avatar
  • 9,936
3 votes
Accepted

J4 - Custom Profile Plugin - Hiding Groups

I don't think it's safe to remove field groups based on fieldset names. They are unrelated and could be named differently, leading to unexpected results. And that is exactly the issue you're running ...
Sharky's user avatar
  • 9,936
3 votes
Accepted

SQL syntax error in query with subquery using JDatabase

You can actual fetch the desired result without implementing a JOIN on a subquery. Use a LEFT JOIN if you want the possibility of zero counts in the results. Use a regular JOIN (INNER JOIN) if you ...
mickmackusa's user avatar
  • 4,761
3 votes

JRequest Method in Joomla 4

Use Joomla\Input\Input class. Instance relevant to the current request can be accessed through the application: use Joomla\CMS\Factory; $controller->execute(Factory::getApplication()->getInput()...
Sharky's user avatar
  • 9,936
3 votes
Accepted

Joomla correct way of routing

You should run the URL through Joomla\CMS\Router\Route::_() before passing to setRedirect() to get the correct SEF URL since none of the involved methods do that automatically. use Joomla\CMS\Router\...
Sharky's user avatar
  • 9,936
3 votes
Accepted

How to get an article id in blog category view inside fields plugin

Field value is rendered during onCustomFieldsPrepareField event which takes 3 arguments: the context string, content item object and the field object. The content item is the second argument passed to ...
Sharky's user avatar
  • 9,936
3 votes

Joomla 4 Views will not load on some Hosts

HtmlView.php is case-sensitive. Also, all other files within the src folder for namespacing are case-sensitive. That is what was causing all the problems.
Brent Cordis's user avatar
2 votes
Accepted

How to add category name to url path for an article in Joomla 4?

With Joomla core you need to setup a menu structure that will correspond to what you want to achieve with your URLs. Menus are important in Joomla. From the example of the URLs in your question - it ...
FFrewin's user avatar
  • 19.6k
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.
Sharky's user avatar
  • 9,936
2 votes

architecture diagram (current 3.x, 4.x) of joomla architecture

Unfortunately there is nothing like this for Joomla 4 yet. With all the amount of work that's gone into it, there's not a major amount of documentation yet. You can however use some other resources ...
Lodder's user avatar
  • 26.8k
2 votes
Accepted

Getting Error "Call to undefined method Joomla\CMS\Editor\Editor::getContent"

As it is explained in core.js: instead of using getContent() method you should use: To get the current editor value: Joomla.editors.instances['jform_articletext'].getValue(); Where ...
Zollie's user avatar
  • 2,846
2 votes
Accepted

Install component run code in postflight

Since you kindly provided the link to the source files, I have downloaded your full Kunena package (6.0 dev.) (for Joomla 4.x.x dev.) just to give it a try and my short conclusion is the following: (...
Zollie's user avatar
  • 2,846
2 votes
Accepted

Where to read about Joomla 4 convention for class names

Components in J4 use a service-based approach which, in theory, should allow any naming convention. Although for that you'd have to write your own factories. But if you want to follow same conventions ...
Sharky's user avatar
  • 9,936

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