Questions tagged [joomla-4.x]
For questions regarding version 4.x of the Joomla! Content Management System.
458
questions
8
votes
1
answer
181
views
Joomla extension update 3.x and 4.x
I have an update server for my extensions, which targets Joomla 3.8 and 3.9
<targetplatform name="joomla" version="3.[89]"/>
With the release of Joomla 3.10 and 4.0 coming ...
5
votes
4
answers
6k
views
JFactory::getDbo() deprecated-- what's the replacement?
I'm running Joomla 3.9.5 and I'm attempting to update my JFactory::getDbo() calls (which are deprecated) to the newer format using the container. However, I'm getting the following error: Call to ...
5
votes
1
answer
116
views
Workflow question: How to fix missing com_messages text?
Whenever a user submits and article on one of my sites, the message that comes across has only COM_MESSAGES_NEW_MESSAGE as the subject and COM_MESSAGES_NEW_MESSAGE_BODY. I've tried several things, ...
5
votes
1
answer
1k
views
Replacing JSubmenuHelper with JHtmlSidebar / Administrative menu in Joomla 4
I've been racking my brain how to add links to all the views of my component in the shiny new Joomla4 backend; I used to do it via JSubmenuHelper, but that, apparently being deprecated also before, ...
5
votes
1
answer
582
views
How to properly display editor instance in Joomla 4
I'm currently updating my component to work in Joomla 4, and I've run into an issue with editors. I previously used this:
$editor = JFactory::getEditor();
$editor->display('text', $this->item-&...
4
votes
3
answers
834
views
Joomla 4 API Question
How to convert a custom Joomla 3 to Joomla 4, and use the Joomla 4 web services API?
I have an extension I wrote for J3 and with a bit of tweaking it works just fine in J4. I want to add web services ...
4
votes
2
answers
2k
views
Adding ajax call in a module for Joomla 4
I'm trying to add an ajax call to Article Latest module.
I added the code below to /modules/mod_articles_latest/src/Helper/ArticlesLatestHelper.php
public static function getAjax()
{
$data ...
4
votes
2
answers
494
views
Is Joomla4 API/Web Service ready for production use?
I've read what little I can find about J4 Web Services, but cannot find a working example or get my code to work. The code below should work by all accounts, but I get forbidden on my local machine ...
4
votes
1
answer
546
views
Best Practice: Loading component Styles & Scripts in J4
What is the best practice for loading styles and scripts?
Option 1:
HTMLHelper::stylesheet(Uri::base().'media/com_mycomponent/css/mycomponent.css');
Option 2:
$wa = Factory::getApplication()->...
4
votes
1
answer
1k
views
How to show list of articles filtered by category and custom field
I am looking for a way to show Joomla 4 articles in a category blog filtered by one (or more) of my custom fields. - The category blog settings in the backend seems only allow to filter by category, ...
4
votes
1
answer
3k
views
'JEventDispatcher' is deprecated in Joomla 4 and what is the replacement
I am using the below code in my current Joomla custom component
Joomla\CMS\Plugin\PluginHelper::importPlugin('captcha');
$dispatcher = JEventDispatcher::getInstance();
$res = $dispatcher->trigger('...
4
votes
1
answer
53
views
How to properly add a query parameter to my Router?
Given the following menu entries
Route::_('index.php?option=com_mycomponent&view=categories&extension=com_mycomponent.countries') should return '/countries' but in fact it returns '/diseases'....
4
votes
0
answers
624
views
(4.1 -> 4.2) Attempted to load class TemplateComponent from namespace Joomla\Component\Administrator\Extension calling $app->getTemplate
I have a file test.php that manually loads the Joomla framework and prints template parameters.
<?php
// test.php, located in the same directory that index.php is
define('_JEXEC', 1);
define('...
3
votes
2
answers
1k
views
Joomla 4 create article programmatically
I have tried a few ways to create articles programmatically in Joomla 4, but none of my attempts are working.
First is to insert data by mysql using $db->getQuery(true) -- the article shows in the ...
3
votes
3
answers
297
views
Migrating custom module to Joomla 4
I have a Joomla 3.x module which calls the category name from the database and then shows this in the module position.
It does this with:
$db = &JFactory::getDBO();
$id = JRequest::...
3
votes
1
answer
92
views
Can I delay loading a css file until a user is logged in?
I have a CSS file on a Joomla 4 site using a custom template, that has code that only applies to special views for logged-in registered (manager level) users on the front end that styles list displays ...
3
votes
1
answer
63
views
Prefill subform with data rows
Im trying to prefill my subform with datarows from the database.
newcustomerform.xml
<?xml version="1.0" encoding="utf-8"?>
<form addfieldprefix="Mydestiny\Component\...
3
votes
1
answer
856
views
'getErrorMsg' is deprecated in Joomla 4 and what would be the equivalent
In my custom Joomla component, I got the below code
$db = Joomla\CMS\Factory::getDbo();
//some code
if (!$row->bind($this->_formdata)) {
if($db->getErrorMsg()){
//do some code
}
...
3
votes
1
answer
2k
views
How to use HTMLHelper to add to the document head
In this post: How to add CSS/JS/an Image to a module backend @lodder shows me how to use HTMLHelper to add CSS and JavaScript.
Previously I had followed the Joomla! documentation https://docs.joomla....
3
votes
1
answer
288
views
Is the following everything one should do to prevent SQL injection?
In order to sanitize the user input in an article insertion form (title and HTML content), here are the bits that I've included:
Use of JInput:
$jinput = JFactory::getApplication()->input;
get ...
3
votes
1
answer
1k
views
Class not found in Joomla 4 when using JDate inside a function
In my last question I tried to modify mod_latest_articles module, and added myCustomFunction to ArticlesLatestHelper.php like this :
/**
* @package Joomla.Site
* @subpackage ...
3
votes
1
answer
665
views
Menu Model Item in Joomla 4
Does anyone know how can I get the current menu model in Joomla 4?
In 2.5/3.X I was using this code:
$model = JModelLegacy::getInstance( 'MenusModelItem' )
->getItem();
But this ...
3
votes
1
answer
234
views
How to create an instance of the Joomla CMS from the browser or the command line
Recently there have been a number of questions posted on JSE relating to how to load the Framework that in most cases is really asking how to load up the Joomla CMS either from a command line or via a ...
3
votes
3
answers
1k
views
Joomla 4 - Invalid controller class:display
I'm building a simple component in Joomla 4, and after reading through some tutorials I feel like I've got it right - but I'm getting this error that I can't explain in the admin view
An error has ...
3
votes
2
answers
746
views
Custom Fields inside Articles News Module in Joomla 4
I want to show some specific Custom Fields inside the Joomla 4 Articles News (mod_articles_news) module.
I used to use this code in Joomla 3 :
<?php $customFields = FieldsHelper::getFields('...
3
votes
1
answer
2k
views
Joomla4 plugin getBody
In Joomla 3.x versions I use JResponse to get and set the body.
function onAfterRender() {
$content = JResponse::getBody();
...
}
But in Joomla4 it returns Class 'JResponse' ...
3
votes
1
answer
60
views
Where are plugins found in Joomla 4?
I'm working with the Joomla 4 alpha 7, and I don't see anywhere to enable / disable plugins. Are plugins not enabled yet?
[edited to add alpha, not beta!]
3
votes
1
answer
81
views
Joomla 4 API for lightbox
I'm trying to upgrade my site to Joomla 4.
In Joomla 3 I used "JHTML::_('behavior.modal');" to display a link to an image inside a lightbox. As also explained in this question: Joomla API ...
3
votes
2
answers
409
views
Invalid controller class: display
I am trying to create a simple component. After installation of the component I get the following error message in the admin view:
An error has occurred.
0 Invalid controller class: display
I've ...
3
votes
1
answer
423
views
Joomla 4 addfieldpath
Has the addfieldpath parameter in custom extension forms changed in Joomla 4? The Joomla admin is no longer finding my component's customized field types.
I'm using addfieldpath="/administrator/...
3
votes
0
answers
47
views
Joomla 4 Pre-Update Check Database Fail
I installed Joomla on my webhost (Siteground) using the one-click installer package. I'm currently on v4.3.2
Everything appears to be working as expected apart from the Joomla update option. It keeps ...
3
votes
1
answer
233
views
Migrate Users from Joomla 3 to Joomla 4 with same UserIds and Passwords
So I successfully migrated users from a Joomla 3 database into a Joomla 4 database. I am hoping there is a nicer way if anyone has done it.
In particular, I couldn't work out how to create a user ...
3
votes
0
answers
271
views
The quickest way to get the POST object in Joomla 3 & 4
I've been creating a lot of webservices API endpoints in Joomla 4 lately and wanted to ask:
"What's the simplest, fastest, most practical way to get the entire POST object when a controller ...
2
votes
2
answers
272
views
How to create a (better) development environment for Joomla 4
I have been writing a custom joomla 4.x component. It's not working. But rather than getting people here to debug my code I want to know how to set up a proper development environment that will give ...
2
votes
2
answers
467
views
Joomla 4 WebAssetManager error
I'm a little confused on the documentation for adding assets to my component, and getting an error message:
There is no "com_supersite.supersite" asset of a "script" type in the ...
2
votes
1
answer
274
views
How can I filter the Persian alphabet in PHP for Joomla 4?
Before anything, I must say this code works as well for the English language, but in Persian it never works.
I use this code on model/celebrities.php.
This code shows my frontend model:
class ...
2
votes
2
answers
485
views
addScriptDeclaration is not working
I am trying to add an inline Javascript in my Joomla 4 plugin using addScriptDeclaration().I edited the code like suggested but the plugin is not working .After enabling it , it is not doing anything ....
2
votes
1
answer
500
views
How to use cache calls in Joomla 4
From the documentation I use this part to store a large chunk of data
if (empty($families)) {
$cache = Factory::getCache();
$families = $cache->call( array( 'JFormFieldFamily', 'getFamilyList' ...
2
votes
2
answers
104
views
Change title for Categories page on custom component
I'm writing a component that will rely on Joomla's Categories to manage its own categories.
Everything's working OK, I just cannot figure out how to change my component's Categories list title.
I'd ...
2
votes
2
answers
190
views
Register Plugin/Class Joomla
We have a custom login plugin which extends the CMSPlugin.
I am trying to register the Class of the plugin inside a module but the following scenarios occur.
Case 1
JLoader::register('...
2
votes
1
answer
123
views
How to initialize joomla modal through js
I'm customizing a view in my component, I have tabs, each tab contains a modal, but when adding a new tab using js, I don't know how to initialize the new tab's modal via js?
2
votes
1
answer
478
views
Joomla 4 - Profile Plugin
I need a custom profile plugin, so I copied the default user profile, renamed some folders/files, and installed it. It installs as if fine and I can activate it, but the fields don't actually display ...
2
votes
2
answers
147
views
Can we get the featured articles in a GET call through Joomla 4 API?
For now we have api/v1/content/articles, but this gets ALL the articles from the site. I do not need the whole list, just the featured articles.
Will we need to create an api-component as a temporary ...
2
votes
1
answer
94
views
403 error front end editing when HTML comments are in the content
I have a site I'm troubleshooting at the moment where articles won't save via the front end and return a 403 error when you either Save or Cancel editing.
After whittling down potential causes, this ...
2
votes
1
answer
291
views
How can I remove front-end Edit button from side menus?
Since upgrading to Joomla 4 (currently 4.1.5, but also occurs in a test site with 4.2.2) an Edit button has appeared above each menu in the front-end sidebar. Previously in 3.10.10 the Edit option ...
2
votes
1
answer
63
views
Joomla upgrade: 3.10.11 to 4.x
I am trying to upgrade my development server from 3.10.11 (which works fine) to 4.x in preparation for Joomla 3.x going out of support in August 23.
When I do run the live update, I get an alert box ...
2
votes
1
answer
139
views
How does a custom component store config.xml information
I've been developing a custom component on Joomla 4 for a few months now and I've finally got round to working on the access and permissions side of things. Whenever I try to access the Options for my ...
2
votes
2
answers
532
views
TinyMCE in Joomla 4: <custom-element> without automatically added <p>
Can someone please tell me how it becomes possible in TinyMCE that a custom HTML element e.g.
<my-custom-element>text...</my-custom-element>
when saving the article is NOT always forcibly ...
2
votes
2
answers
1k
views
Loading a helper file in Joomla 4
I'm having trouble with using a helper file in Joomla 4, I'm not really sure where I'm going wrong.
I have a helper file in my template, like templates/mytemplate/html/helper.php and this works well ...
2
votes
1
answer
57
views
Creating a field plug-in, need the com_content form to be enctype multipart
I've been writing a field plug-in for adding files to articles in com_content. I've got the basics of the field plug-in working ok, extending the JFormFieldFile class
The issue I've hit is, for the ...