Questions tagged [joomla-4.x]
For questions regarding version 4.x of the Joomla! Content Management System.
166
questions
2
votes
1
answer
35
views
Getting somehow the Article ID in an Alternate Layout for Custom Fields
I am creating an Alternate Layout of /components/com_fields/layouts/field/render.php to change the layout of some given Custom Fields. And there I need the ID of the article in order to give a unique #...
4
votes
2
answers
220
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 ...
1
vote
1
answer
533
views
How to get user session info from external php script with Joomla-4.x?
How we can get the logged in user information and session information from external php script with Joomla-4.x?
The below code working with Joomla 3.x and doesn't working with Joomla-4.x
define( '...
1
vote
1
answer
74
views
How does Joomla 4 decide a component is legacy?
What determines whether Joomla 4 treats something as a legacy component?
1
vote
1
answer
476
views
Router for Joomla 4
I cannot find any documentation on router changes for Joomla 4. Can anyone advise? It appears that placing a router.php file in the base directory for the component still works - although not in ...
2
votes
0
answers
252
views
Joomla 4 - router.php SEF-URLs broken since update
This current router.php creates in Joomla 4 this URL: localhost/component/ohanah/?id=688&Itemid=101
But it should create this: localhost/kurse/688-event-name where "event-name" is the ...
1
vote
2
answers
781
views
How to get/call Joomla 4 custom fields into module
I tried below code
<?php
$article_id = 2;
$model = JModelLegacy::getInstance('Article', 'ContentModel');
$article = $model->getItem($article_id);
JLoader::register('FieldsHelper', ...
1
vote
1
answer
255
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
}
...
0
votes
1
answer
205
views
'JModuleHelper' is deprecated in Joomla 4 and what is its equivalent
I am using the below joomla code in my custom component.
$module = JModuleHelper::getModule('mod_mycustommodule');
$moduleParams = new Joomla\Registry\Registry($module->params);
It seems '...
1
vote
1
answer
752
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('...
0
votes
1
answer
80
views
Trying to write a custom form field that concatenates <input> and <select> values
I am a novice dabbler in Joomla PHP. I can build custom templates and simple frontend modules. I’m trying to write my first custom form field. I’ve gone over the documentation, reviewed several ...
2
votes
1
answer
72
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-&...
3
votes
1
answer
136
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()->...
1
vote
1
answer
84
views
Security concern in Joomla .php: is define('_JEXEC', 1) safe to use?
I came across this on joomla.stackechange which has me concerned:
"define('_JEXEC', 1) is a bad for security in the module. It allows people to use this file as an alternative entry point for ...
7
votes
1
answer
120
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 ...
1
vote
0
answers
129
views
Multiple Stripe Webhooks for checkout.session.completed from various Joomla components
Scenario
Site has OSMembership for subscriptions
Site has RSForms Pro for registering for in person / virtual courses
Site has J2Store for some miscellaneous products
In Stripe, I've set up two ...
0
votes
1
answer
62
views
Joomla 4 extension language files no longer go to 'site/languages/en-GB' when install via discovery
I'm developing a template and I find it both interesting and confusing to how Joomla 4 loads language files.
First there is the templateDetails.xml notation:
Cassiopeia uses
<languages folder="...
0
votes
1
answer
44
views
loadForm change behaviour from J!3.9 to J!4.0 and data not loaded with the form
In my component in a model backend, I'm loading a form but since moving the code to be used on J!4.0 the data associated to the form isn't loaded anymore.
The loadForm is called: https://github.com/...
1
vote
1
answer
514
views
Joomla4: Load a custom stylesheet (admin.css.php) in administration
I want my custom modules & custom template to fetch the parameter values (colors) from my custom template's backend. This way I can see what colors I'm picking when when I'm configuring my website....
0
votes
1
answer
246
views
How to Fix PHP Deprecated : Factory::getDocument() is deprecated
How can I fix the following deprecation error generated by my php code?
Factory::getDocument() is deprecated
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
...
2
votes
2
answers
240
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
169
views
Use HTMLHelper::_ by calling a namespaced class
In my component under Joomla! 4.0, I have the following call which returns:
error JHtml componentname not found.
HTMLHelper::_(
'componentname.link',
'index.php?option=com_component&view=...
2
votes
1
answer
460
views
Joomla 4 website's backend not working after renaming htaccess.txt to .htaccess
I got a issue after renaming htaccess.txt to .htaccess in the public_html folder of my Joomla 4 website (https://www.freepetsitters.com). I renamed it in order to get rid of "index.php" in ...
2
votes
1
answer
153
views
Joomla 4.0 Text sprintf
I know at some point sprintf was a method of the JText class, but it doesn't seem to work in Joomla 4.0. I tried the following, not working:
$str = Text::sprintf('...
1
vote
1
answer
161
views
What is url for calling task in controller for Joomla 4?
This is my ajax query for calling a task in the controller (it works for Joomla 3 but doesn't work for Joomla 4):
$.ajax({
type: "POST",
url: "index.php?option=com_scrib&...
0
votes
1
answer
70
views
How to check an extension is namespaced?
I'm working on namespaced templates feature and I came to the point where I need to check if an extension is namespaced or not.
One possibility would be to load the templateDetails.xml file and check ...
2
votes
1
answer
597
views
Get the Article ID in J4.0
I am trying Joomla 4.
My biggest problem is to migrate the get article id functionality.
In Joomla 3.x, I used:
defined('_JEXEC') or die;
$id= JRequest::getInt('id');
but this is not longer ...
0
votes
0
answers
153
views
Warning! Internet Explorer should not be used error, on mobile browsers
After some problems with a Joomla 4( beta 6) install on ubuntu 18.04 with Nginx tried another instance for test purposes. This time on an Ubuntu 20 server with Litespeed( Open LS). Wich I don't know ...
1
vote
1
answer
84
views
Workflows in Joomla 4
As we all know Joomla 4 is on the horizon and the improvement to workflows are definitely an interesting addition.
From what I've seen, the workflow works great for new content, but what about content ...
1
vote
0
answers
103
views
Joomla 4: ID state of last saved row not available via $this->getState($this->getName() . '.id')
So i have a strange effect when trying moving a MVC component of mine to Joomla 4. I could break it down to a very simple test.
If you look at the \libraries\src\MVC\Model\AdminModel.php file around ...
0
votes
0
answers
132
views
Joomla 4 not showing error in admin Panel
I am using Joomla 4 and working on a custom module and getting this error in my Joomla admin site. My problem is I am unable to get the error details instead I only get this Error: The 'atum' service ...
0
votes
1
answer
284
views
Sign Up / Login with just OTP
I had a request to build a website for a targeted market that is allow its user to signup using their phone number only without entering email address just like mobile apps nowadays. I know this can ...
1
vote
2
answers
132
views
Update from 3.9.x to 4.x
I want to try Joomla 4.x
In the documentation for Joomla 3.x to 4.x Step by Step Migration it says:
Select Joomla Next (This is the current text - it may be different in the future) from the drop-...
2
votes
1
answer
356
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 ...
0
votes
1
answer
184
views
How to get the currently installed Joomla! Version in PHP
For one of my extensions i need a switch statement if the Joomla! Version is 3.x or 4. (in fact i have to call the Articles Model in different way for J4) - but how can i get the actual installed ...
0
votes
1
answer
120
views
Optional fields in renderFieldset
I'm updating a component of mine to use the renderFieldset method and remove some unnecessary code in the form template files. However, some of my fields show / hide based on other preferences in the ...
2
votes
1
answer
197
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/...
2
votes
1
answer
534
views
Joomla 4 namespacing and autoloading
I've added the namespace line to my manifest xml: <namespace>Mycompany\Component\Mycomponent</namespace>
When I install the component, I'm not seeing any alias added to the libraries/...
1
vote
2
answers
288
views
How to set the view location in Joomla 4
I'm rebuilding a component called DogWalk for Joomla 4 and I've tried to ensure I'm doing exactly what the core Banners component does. I've named and namespaced my files, named my directories ...
2
votes
0
answers
129
views
CLI for joomla 4 not working for me
Joomla 4
PHP 7.3.1
Composer and NPM node modules installed
Following this doc on Joomladocs, CLI Update, php cli/joomla.php - and whatever command I add after doesn't work. I get an error message (...
3
votes
1
answer
588
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' ...
1
vote
1
answer
156
views
As JSubmenuHelper is deprecated, how to migrate to JHtmlSidebar?
The only source I found about this is from this post: Replacing JSubmenuHelper with JHtmlSidebar / Administrative menu in Joomla 4
The issue here is that I tried it, and it doesn't show the Sidebar ...
0
votes
1
answer
77
views
How to render nested modules, (parent outside articles)
I tried the following code:
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$position = 'precisions';
$options = array('style' => 'raw');
echo $...
0
votes
0
answers
87
views
How to package modules with admin back-end
Say I want to take mod_custom as a base for a future module. This module has an admin back-end and is not provided as package.
After modifications, how can I package it for installation? Seems there ...
1
vote
1
answer
137
views
How to set a root article as subpath url for children articles
How to set a root article as sub-path URL for children articles?
Meaning, I have a root page named article0, and article{1-100} under this root article.
I want to display the article0 under the URL ...
2
votes
1
answer
677
views
Updating JEventDispatcher triggers
Can anyone explain or point me to information on the new way to handle events in Joomla 4? I'm updating a component that uses triggers to display plugins, and it looks like this:
$dispatcher = ...
3
votes
1
answer
953
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....
0
votes
1
answer
53
views
Editing a module from another component
Suppose I want to edit the field ("Home") of a module (say mod_breadcrumbs) from edit.php file of another module.I want to use the radio button inside another module instead of using here. Is this ...
-2
votes
1
answer
38
views
What does the line in the code below does? [closed]
$hasContent = empty($this->item->module) || isset($this->item->xml->customContent);
line 23 in /administrator/components/com_modules/tmpl/module/edit.php
0
votes
1
answer
47
views
Where might the code for this screenshot lie in joomla 4 [closed]
The link to this url on localhost is administrator/index.php?option=com_menus&view=item&client_id=0&layout=edit&id=101