[4.0] Support namespace module for com_ajax#32291
[4.0] Support namespace module for com_ajax#32291joomdonation wants to merge 4 commits intojoomla:4.0-devfrom
Conversation
|
Better to use the Joomla 4 way and boot the module. Then you don't have to manually include the file. How to load the helper can then be done with extending the module interface. But manually construction namespaces and class names should be something of the past. |
@laoneo please show an example, |
|
If you mean So there no other way than just parse XML directly. |
|
@laoneo Look at how boot the module works for Joomla 4, I still don't understand how it would help here. Could you please explain more details? Or if you could work on this Release Blocker item, that would be better. |
|
Tested as explained. |
|
But you can extend the module interface to get the module helper class. SOmething like |
|
So basically, move the logic to load helper class to https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Extension/Module.php ? |
|
You can either move your logic there. Better and cleaner way would be to introduce a helper factory, similar to what we did with the dispatcher factory https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Dispatcher/ModuleDispatcherFactory.php. Guess @wilsonge needs to give here his input what he would accept for 4.0. |
@laoneo problem with Helper, they all "static", I mean they is "abstract", |
|
Perhaps we need to get rid of static then. |
|
For the time being, how about adding a method to ModuleHelper https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Helper/ModuleHelper.php to return the helper class? |
|
hm, what if we try Anonymous classes? new class extends $helperClass{}but it a bit dirty 😄 Another idea, something like: $dispatcher = $app->bootModule($module->module, $app->getName())->getDispatcher($module, $app);
$dispatcher->dispatchHelper('onAjaxFooBar');Because a loot of helpers use
Would be better if we find solution now, because it will stay forever 😉 |
|
Why not add same logic to templates as for modules? Follow #30816 |
|
@laoneo perhaps at this point we need to do something about a I say let's start with my commit #30816 (RTC now) since it will be required by this commit and child templates features. |
|
@thednp |
|
@laoneo please lay out a plan and lets get to work, I'm ready to take some work. |
|
@joomdonation you shouldn't close it that fast. Perhaps I'm on the wrong path too 😏 |
|
@joomdonation I hope you re-commit this PR with updates for #32633 |
Was waiting for your PR, hehe. |
|
Hi guys, I know this issue is already closed but has this issue really been resolved? It's still returning The file at mod_articles_categories/helper.php does not exist in Joomla 4.0.3. and com_ajax still looks for Mod class prefix in helper class name. |
Pull Request for Issue #32136 .
Summary of Changes
Modify com_ajax to support namespace module.
Testing Instructions
http://localhost/joomla4/index.php?option=com_ajax&module=articles_categories&method=getData&format=json
Before patch, you will get this error
{"success":false,"message":"The file at mod_articles_categories/helper.php does not exist.","messages":null,"data":null}
After patch, you will get this success response:
{"success":true,"message":null,"messages":null,"data":["test"]}
You can install the modified mod_articles_categories.zip which I attached here so that you don't have do the step #2 (modify code)
mod_articles_categories.zip