Questions tagged [joomla-4.x]
For questions regarding version 4.x of the Joomla! Content Management System.
345
questions
8
votes
1
answer
170
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 ...
4
votes
4
answers
4k
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 ...
4
votes
2
answers
397
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
3
answers
578
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
1k
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
1
answer
73
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, ...
4
votes
1
answer
862
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, ...
4
votes
1
answer
355
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
0
answers
289
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
1
answer
79
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
41
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
1k
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
232
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
402
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()->...
3
votes
1
answer
495
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
2
answers
449
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
58
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
58
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
1
answer
1k
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
2
answers
193
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
340
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
102
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 ...
2
votes
3
answers
170
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::...
2
votes
2
answers
207
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
675
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 ...
2
votes
2
answers
258
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
2
answers
394
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
2
answers
83
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
105
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
102
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
267
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
71
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
2
answers
341
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 ...
2
votes
1
answer
77
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
192
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
58
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
2
answers
424
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
834
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
52
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 ...
2
votes
1
answer
694
views
Proper way for autoloading in Joomla 4
I'm trying to make my news module modification working with Joomla 4. My module is calling custom fields and I use this autoloader below to make it work in Joomla 4. Can you tell me what is the proper ...
2
votes
1
answer
367
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
1
answer
791
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 ...
2
votes
1
answer
763
views
Joomla 4 alpha mootools library
To whom it may concern:
I just installed joomla 4.0 alpha and installed a custom extension of mine there in which uses mootools (JHTML::_('behavior.modal');), but it simply does not work.
is there ...
2
votes
1
answer
38
views
How to 3rd party routing to my component?
I need to add EasySocial routing to my own component, so that JRoute([some EasySocial link]) outputs a proper EasySocial URL.
How can I do that? If I understand correctly, EasySocial routing is active ...
2
votes
1
answer
185
views
Use Ajax to refresh available options
I'm struggling with coding an ajax refresh of options in a select list based on what's already selected in the previous field.
Scenario is I get a list of positions and each position one or many ...
2
votes
1
answer
30
views
Why can't Discover find my extension or What is Discover looking for?
As a result of a mistake I made in the way I set up an extensions symlinks my extension was not being found when using the Discover feature of Joomla, this lead me to stepping through the installer ...
2
votes
1
answer
50
views
Registering EasyPost library in J4 module - Class not found
I have created a very basic module to display EasyPost Tracking information for our customers. The module works in J3, but in J4 I get an error.
This is the code I have:
use Joomla\CMS\Factory;
$input ...
2
votes
1
answer
50
views
use file or filename in XML
What tags do I correctly use in the XML file to install an extension to add a file?
filename or file?
In example code (https://codeberg.org/astrid/j4examplecode/src/branch/tutorial/src/plugins/content/...
2
votes
1
answer
217
views
Replacement of Factory::getUser($userid); in Joomla! 4.2
I have an issue with different behaviour by replacing deprecated code. On my extension dedicated for Joomla! 3.10 i used this part of code :
$userid = $this->input->getInt('userid');
$this->...
2
votes
1
answer
310
views
J4 component URL not SEF
Context: I have a component that works fine in J3 and I want to migrate it to J4.
Problem: When I create a menu (Joomla main menu) on the frontend view of the component, in J4 only, the URL is not SEF ...