?
avatar smehrbrodt
smehrbrodt
12 Jan 2018

Steps to reproduce the issue

Insert a module into an article.
The module gets referenced by its type and name.
However, when changing the name of the module (maybe unknowing that the module is used in an article), this doesn't work anymore.
Rather the ID should be used which doesn't change.

Expected result

Module identified by module type and ID:
{loadmodule mod_example,123}

Actual result

Module indentified by module type and name
{loadmodule mod_example,Module title}

System information (as much as possible)

Joomla 3.8.3

Additional comments

--

avatar smehrbrodt smehrbrodt - open - 12 Jan 2018
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jan 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Jan 2018
avatar Bakual
Bakual - comment - 12 Jan 2018

If you reference by ID, you could take off the type as that information isn't needed anymore.
I think it is done like this so it is easier to understand what module is inserted in a given article. Using an ID you will have to lookup up the module in the module manager.

And of course the same error could happen with an ID as well if someone accidentally deletes a module. Only that he will have no luck recreating it once he notices the error.

avatar smehrbrodt
smehrbrodt - comment - 12 Jan 2018

If you reference by ID, you could take off the type as that information isn't needed anymore.

Correct. However, maybe that's helpful information? I don't really care.

And of course the same error could happen with an ID as well if someone accidentally deletes a module. Only that he will have no luck recreating it once he notices the error.

What I do is to put a note on modules I use in articles "This is used in an article". So I wouldn't delete it by accident.
But still I'd like to change the title without going through all articles and update the module title there as well.

avatar mbabker
mbabker - comment - 12 Jan 2018

+1 for supporting syntax using the module ID. There are tradeoffs in each direction if you're using syntax using module names or IDs, but I'd suggest the ID syntax is less prone to being broken by other site changes short of deleting the module (FWIW in one of my older projects this was feature requested because of how easily the plugin was broken by changing the title on referenced content, and because that plugin supported title references to content which might have duplicate titles so the right reference wouldn't resolve but using ID it always would).

avatar brianteeman
brianteeman - comment - 12 Jan 2018

Makes sense to me. Should be a relatively easy change to make the plugin insert the id instead of the module title. Its all JS in here

/** Use the API, if editor supports it **/

and then update the plugin itself to recognise id and not title

avatar Bakual
Bakual - comment - 12 Jan 2018

The JS is only one part. The content plugin currently doesn't support referencing the ID so that needs to be added to it and the syntax needs to be distinguishable from the old loadmodule behavior (may be possible by checking for integer).
Then we need a way to fetch the module by its ID. Currently the ModuleHelper class doesn't allow this. Maybe there is already an API in another class that could be used.

avatar alikon
alikon - comment - 12 Jan 2018

something like
{loadmodule module, id:12345}
or
{loadmodule id:12345}
sounds like a good idea

avatar mbabker
mbabker - comment - 12 Jan 2018

Definitely should have some sort of id: prefix otherwise you start introducing magic behaviors trying to handle it differently based on whether an integer or string is given. About the only possible problem that's created is you implicitly block creating modules named "id:XX".

avatar alikon
alikon - comment - 12 Jan 2018

then some kind of this syntax maybe ?
{loadmoduleid id:12345}

avatar alikon
alikon - comment - 12 Jan 2018

without the JS side #19362

avatar Quy Quy - change - 13 Jan 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-01-13 17:10:36
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 13 Jan 2018
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 13 Jan 2018
avatar joomla-cms-bot
joomla-cms-bot - comment - 13 Jan 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19360

avatar Quy
Quy - comment - 13 Jan 2018

see PR #19362


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19360.

avatar iamrobert
iamrobert - comment - 7 Nov 2019

It works in latest Joomla with:

{loadmoduleid 200}

200 specify module id

avatar hakanara hakanara - comment - 27 Feb 2020
avatar ReLater
ReLater - comment - 27 Feb 2020

@hakanara
Done!

(Anybody can write docs or update them. You, too ;-) Just register on https://docs.joomla.org/ and start.)

avatar hakanara
hakanara - comment - 27 Feb 2020

Thank you very much @ReLater . I didn't know that but I would like to learn :-)

Add a Comment

Login with GitHub to post a comment