I have a site on Joomla 3.8.5. When I try to assign a module to a menu of menu item type = URL, the check box is "greyed out" and no longer selectable.
This has always been possible until the latest update.
Create a menu item type URL.
Try to assign a module to this menu item. You cannot.
Should be able to assign modules to this menu item. However, it is not clickable/ assignable (it gets greyed out)
As you can see here - I am not the only person with this problem. I believe it to be a bug.
Joomla 3.8.5, all extensions up-to-date.
Here is an example of the menu URL:
index.php?option=com_auctionfactory&task=listauctions&filter_type=auctions_only&cat=12
URL menu items aren't Joomla system menu items. They're intended for absolute URLs, typically off-site. If you need to configure modules for an on-site page, it should be configured using one of Joomla's other menu item types.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-15 14:18:00 |
Closed_By | ⇒ | mbabker |
Hi Brian/ mbabker, this has always been possible with Joomla until recently.
I understand perfectly where you are coming from, and this should be the case with for example with a Menu Item Alias or Seperator.
However, the URL type specifies Internal OR external menu. A menu item id gets attached to the page.
I use a Joomla plugin called Auction Factory, that unfortunately is not perfect (and is not alone here). Some menu items have to be created using query strings and use Menu Item Type URL. So they are internal links set up using the Menu item type URL.
For now I have gone into the table and edited the database directly to get round the issue for my client. I don't see the benefit in preventing modules being attached to this type of menu item.
Recently is a year ago, the UI restriction was added as of #12752 (included in 3.7.0).
Part of it boils down to not being a menu item type that can be used normally for routing purposes (the URI can most likely be parsed down to match a menu item, but you can't build the URI for that in the code without having the menu item ID already (in code you would have to always use JRoute::_('index.php?Itemid=123');
, it could never be built as JRoute::_('index.php?option=com_component&view=component&id=1');
)).
Because the menu item is saved with an ID, of course you can mess with the database to make this use case work, but I would suggest that it's not a workflow we need to support in core as in more cases than not a site owner would not be using this menu item type to handle internal routing and in essence bypassing a component's own router configurations.
Well this site updates once a year, so I accept that the UI restriction happened a year ago - and thank you for the link.
It seems a shame to me as it takes away flexibility from anyone trying to get a little more out of Joomla (or getting around floors/ limitations of plugins).
Anyway, I don't want to go on, so is this a definitive answer?
Thanks.
Updating once a year - are you serious? So as your site has been wide open to security vulnerabilites this is the least of your issues.
I can be convinced otherwise if there's a strong use case for it but personally I see this as one of those edge cases where when you need it it is nice to have but not really something that core needs to do out of the box.
If I'm not mistaken the limitation is only imposed by the UI anyway, so you could maintain a template override of https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_modules/views/module/tmpl/edit_assignment.php and remove the restriction on URL menu item types without impacting anything (you'd just need to watch that file for changes and keep it in sync).
Brian - you are shooting the messenger here ;-) . We always advise clients to update continuously. But if we are paid to update yearly, we can only update yearly for them.
Mbabker - I am surprised other people have not had the issue over the year since the change. I will try and override for now if it is possible (thanks for the override link). The clients run their own site and often change the modules on these pages as they run monthly auctions.
Possibly no one else had the issue because they were using correctly coded extensions
incorrect.
I have several clients that use URL type menu items for internal links because of sloppy coding.
Removing the functionality has cause no end of problems when the client that owns the site has no alternative to use.
The overriding option mentioned above works nicely in the admin UI so that you can select the option, however, it for me had no effect when actually showing the page.
fix the sloppy code - simple
Brian, are you volunteering to fix the sloppy code in these extensions? I am sure the extension creators would appreciate your helpful gesture.
rgjoyce, did you find a solution to this? I am going to try the template override option now. I hope it works.
Jey, how did you update the edit_assignment.php page last year? I am trying to get it to work now but cannot. I am doing something wrong.
Brian - you are shooting the messenger here ;-) . We always advise clients to update continuously. But if we are paid to update yearly, we can only update yearly for them.
Mbabker - I am surprised other people have not had the issue over the year since the change. I will try and override for now if it is possible (thanks for the override link). The clients run their own site and often change the modules on these pages as they run monthly auctions.
If I remember I followed the advice from mbabker above and removed the url from the restrictions:
If I'm not mistaken the limitation is only imposed by the UI anyway, so you could maintain a template override of https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_modules/views/module/tmpl/edit_assignment.php and remove the restriction on URL menu item types without impacting anything (you'd just need to watch that file for changes and keep it in sync).
kr
I enabled URL Rewriting and it started to work
mbabker,
The restriction causes an issue with external website that generate their styles from a website. Case in point. My client is a chamber of commerce and they use ChamberMaster for chamberf maintenance. ChamberMaster generates the page displays from their site which is displayed on our site. I have to use a URL link to display the content. I setup a 'business' subdomain that they use to generate the full page display. It's a 'weird' setup but I have to work with their system.
Look at this link:
The 'content' display is generated on their site but embedded on our client site which they retrieve the rest of the page contents from the client site. As you can see, it works well with one exception. There is no 'title' module display. Click on this link:
As you can see, there is an 'Advocacy' module that display the title which I use a 'negative' margin-top to overlay the fullwidth section. I would like to be able to do the same with the pages generated on the ChamberMaster website but the assign menu link option for those pages are not 'clickable' as they are all URL links.
I saw the link above on adding a template override so I gave it a try.
I edited the 'edit_assignment.php' to hide the URL 'uselessMenuItem' code.
<div class="treeselect-item pull-left">
<?php /*
$uselessMenuItem = in_array($link->type, array('separator', 'heading', 'alias', 'url'));
*/
?>
<input type="checkbox" class="pull-left novalidate" name="jform[assigned][]" id="<?php echo $id . $link->value; ?>" value="<?php echo (int) $link->value; ?>"<?php echo $selected ? ' checked="checked"' : ''; /*echo $uselessMenuItem ? ' disabled="disabled"' : '';*/ ?> />
<label for="<?php echo $id . $link->value; ?>" class="pull-left">
<?php echo $link->text; ?> <span class="small"><?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($link->alias)); ?></span>
<?php if (JLanguageMultilang::isEnabled() && $link->language != '' && $link->language != '*') : ?>
<?php if ($link->language_image) : ?>
<?php echo JHtml::_('image', 'mod_languages/' . $link->language_image . '.gif', $link->language_title, array('title' => $link->language_title), true); ?>
<?php else : ?>
<?php echo '<span class="label" title="' . $link->language_title . '">' . $link->language_sef . '</span>'; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($link->published == 0) : ?>
<?php echo ' <span class="label">' . JText::_('JUNPUBLISHED') . '</span>'; ?>
<?php endif; ?>
<?php if ($uselessMenuItem) : ?>
<?php echo ' <span class="label">' . JText::_('COM_MODULES_MENU_ITEM_' . strtoupper($link->type)) . '</span>'; ?>
<?php endif; ?>
</label>
</div>
Then I uploaded the file to both 'administrator/templates/isis/html/com_modules/views/module/tmpl' as well as 'administrator/templates/isis/html/components/com_modules/views/module/tmpl' folders. (FYI, I don't think the 'components' folder is needed but it didn't work on the 'com_modules' folder only so I tried it anyway.
It did not fix the issue.
So I decided to replace the original in the "administrator/components/com_modules/views/module/tmpl" folder. I renamed the original to edit_assignment.php-original' and uploaded the changed 'edit_assignment.php'.
Now when I try to open the module, I get this error message:
"Layout edit_assignment not found."
Can you see where I made the mistake in my code changes?
@LukeDouglas2 Place the override in administrator/templates/isis/html/com_modules/module
.
In fact simpler code change I guess is to modify
$uselessMenuItem = in_array($link->type, array('separator', 'heading', 'alias', 'url'));
to
$uselessMenuItem = in_array($link->type, array('separator', 'heading', 'alias'));
Please use the forum (http://forum.joomla.org) for support requests.
If you think the CMS code should be changed, please open a new issue (and reference this here if needed).
Bakual,
I will use the forums for coding support requests. However, I will be submitting a 'new issue' as there 'really' is no need to have this limitation.
Infograf768
I replaced the code as you suggested, on the "administrator/components/com_modules/views/module/tmpl/edit_assigment.php" file which removed the " , 'url' ". It worked! I was able to select the menu item I wanted the module to display. I cleared all cache (browser, Joomla, ChamberMaster) and reloaded the page but it did not display. I checked the developer tools and that section 'g-showcase' which is where the module 'showcase-a' is set does not display on the page at all. The previous section 'g-fullwidth' is displayed and the next section 'g-system-messages' is there.
Just to ensure that the module could be assigned, I assigned it to another page 'not a URL' and it did display the module. I even assigned it to a module position that was displayed on the page but it still did not show this module.
So even though the menu item link is checked, it 'appears' that it is not generated for section on the link even though the previous section and the following section are generated. Is there anything else you can suggest?
@LukeDouglas2
As @mbabker rightfully said, your problem is for the forum or for this list:
joomla-dev-general@googlegroups.com
Anyway I would not be able to help you at all as your setting is a highly customized one which I am totally unable to understand.
Thanks. I did post it on the forums but, so far, no responses. I'll post to the gitter.im/gantry/gantry5 chat thread.
On Thu, Aug 1, 2019, 1:00 AM infograf768 notifications@github.com wrote:
@LukeDouglas2 https://github.com/LukeDouglas2
As @mbabker https://github.com/mbabker rightfully said, your problem is
for the forum or for this list:
joomla-dev-general@googlegroups.comAnyway I would not be able to help you at all as your setting is a highly
customized one which I am totally unable to understand.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/joomla/joomla-cms/issues/19692?email_source=notifications&email_token=AEAQP7IZY75DUKWIJRIWQT3QCJ3XTA5CNFSM4EQ3TFG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3JNAIY#issuecomment-517132323,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEAQP7P5TVJKALW352IALR3QCJ3XTANCNFSM4EQ3TFGQ
.
I too just learned the hard way that this option was removed.
I today needed to assign a module to a menuitem for an INTERNAL URL for a component, but as described above, this possibility is no longer.......
It is a shame as it would have been an easy fix for me.
I do see above it being mentioned that needing this code is a result of "sloppy coding", and I am not arguing with the experts here.
It however seem like a lot of people have been in need of this little functionality, and I must admit that I have been using this myself at times when the developer have not allowed for all different menuitems in their coding.
I see there are many suggestions on changing the core code here and there, but that again means that us Joomla users need to keep an extra eye on this and reapply this change every time the code changes. That is just another potential risk.
Finally, the functionality was there in the past, and it was useful for me (and many others) in many cases as we all know that Joomla extensions are not all developed by flawless experts.
It would therefore have been great if it again became possible to assign modules to menuitems configured as an internal URL.
Of course you cant assign a module to a menu link of type url. Where would it be displayed. There is no page to display it