J4 Issue ?
avatar webchun
webchun
24 Jan 2021

Steps to reproduce the issue

I see that all default modules store its helper.php file under Helper folder, for example modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php
So I'm assuming when I create a custom module, I should place my helper.php file under folder :
modules/mod_my_module_name/src/Helper/ and name it MyModuleName.php

But when I try to use com_ajax within my module by using :
index.php?option=com_ajax&module=my_module_name&method=getList&format=json
it returned
{"success":false,"message":"The file at mod_my_module_name\/helper.php does not exist.","messages":null,"data":null}
Then when I look into com_ajax file : /components/com_ajax/ajax.php
the path is indeed hardcoded to :
$helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php';

System information (as much as possible)

Joomla 4 Beta 5

Additional comments

avatar webchun webchun - open - 24 Jan 2021
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Jan 2021
avatar webchun webchun - change - 24 Jan 2021
The description was changed
avatar webchun webchun - edited - 24 Jan 2021
avatar Fedik
Fedik - comment - 24 Jan 2021

That is namespacing issue.
But can be a problem with com_ajax, I agree.

Either need to fix com_ajax or use dummy helper.php that include MyModuleHelper.php

avatar Fedik
Fedik - comment - 24 Jan 2021

a better title for the issue: "[4.0] com_ajax do not work with namespaced module"
or something in this way.

avatar dgrammatiko
dgrammatiko - comment - 24 Jan 2021

This is a Release Blocker

cc @richard67

avatar richard67 richard67 - change - 24 Jan 2021
Title
Helper.file path convention for modules
[4.0] Helper.file path convention for modules
avatar richard67 richard67 - edited - 24 Jan 2021
avatar richard67 richard67 - change - 24 Jan 2021
Labels Added: J4 Issue ?
avatar richard67 richard67 - labeled - 24 Jan 2021
avatar richard67 richard67 - labeled - 24 Jan 2021
avatar richard67 richard67 - change - 24 Jan 2021
Build J 4 4.0-dev
avatar richard67
richard67 - comment - 24 Jan 2021

See also #25685 .

avatar joomdonation
joomdonation - comment - 3 Feb 2021

Please test PR #32291

avatar Quy Quy - change - 3 Feb 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-02-03 16:10:53
Closed_By Quy
avatar Quy Quy - close - 3 Feb 2021
avatar wilsonge wilsonge - change - 20 Feb 2021
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 20 Feb 2021
avatar webchun
webchun - comment - 5 Oct 2021

Hi guys, I know this issue is already closed but is this issue really already solved because the issue is still persist in Joomla 4.0.3. Also, it looks like com_ajax still looks for Mod class prefix in helper class name.

avatar dgrammatiko
dgrammatiko - comment - 5 Oct 2021
avatar webchun
webchun - comment - 9 Oct 2021

@webchun check https://github.com/dgrammatiko/invalidate-cache/tree/main/src/invalidatecache There are some changes between J3 and J4

I din't see that relate with my question can you explain it?

avatar dgrammatiko
dgrammatiko - comment - 9 Oct 2021

Follow the changes:

Or just follow the module I just referenced above as it implements the J4 way...

Add a Comment

Login with GitHub to post a comment