I noticed a minor issue in mod_articles_categories module, for the Categories URLs, because of the way ContentHelperRoute::getCategoryRoute
handles the $layout
from $jinput
.
Not sure if this bug appears anywhere else where ContentHelperRoute::getCategoryRoute
is called, but for the mod_articles_categories we get URLs like below in cycles, depending from where we view the categories and when there is no menu-item for those categories to define a layout.
index.php?option=com_content&view=category&id=12&layout=&Itemid=119
index.php?option=com_content&view=category&id=12=&Itemid=119
Notice that the layout param in the first occasion is just empty, which with SEF on it ends up to URLs like below:
/blog/nature/16-animals?layout=
/blog/nature/16-animals
To reproduce this, create an articles categories module for a category tree e.g. you have a blog category and subcategories. Create menu items for the parent categories and just let the children without menu items. Place the module in all pages (articles, featured items and even other component), so to make sure there isn't a $layout
for the categories view defined.
Start clicking on your module's categories links from your various pages and you will notice the non-constant URLs.
Categories URLs should be the same for the same categories.
Categories URLs toggles as described above, depending on the $layout param.
Joomla 3.8.7
The issue appears to be in the way ContentHelperRoute::getCategoryRoute
deals with the layout param from $jinput
/components/com_content/helpers line 82 - 88:
$jinput = JFactory::getApplication()->input;
$layout = $jinput->get('layout');
if ($layout !== '')
{
$link .= '&layout=' . $layout;
}
At line 85, it does a strict comparison for $layout !== ''
and if it's not, then it appends it to the URL. But this is not always the case, as I don't know about other cases, in those that I tested it out, $layout came back as null. So the $layout !== '' results to true.
I think that unless we are expecting a layout to equals to "0", we could go with:
if (!empty($layout))
Labels |
Added:
?
|
Title |
|
I think we already have a PR for this, can't remember which one
Status | New | ⇒ | Discussion |
Category | ⇒ | com_content Router / SEF |
Category | com_content Router / SEF | ⇒ | com_content com_modules Router / SEF |
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-22 09:33:46 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_Date | 2018-05-22 09:33:46 | ⇒ | 2018-05-22 09:33:47 |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/20527
Thanks folks... my memory is not what it was... ;)
Also - not sure about this - but what about in the case of a missing $layout for a category to default to the categories/global params?