-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
What happened?
This has been reported a few times since the release of j4 and I think I have finally got to the bottom of it. Sadly I dont have the fix but I hope there is enough information here for someone to be able to fix the missing piece
To see the problem in action (any version of Joomla) go to the content categories menu and click on one of the counters to open a filtered view of the articles.
This will correctly open the article view with the selected filter
The problem however is that we have now lost the active menu item in the menu sidebar
It should be displayed like this
The reason for this is that the url generated in the category view is structured
administrator/index.php?option=com_content&filter[category_id]=2&filter[published]=1&filter[level]=1
Note that there is no view=articles
The link worked because articles is the default view for com_content but the active menu is not set because that relies on the view
You can verify that the acticve menu is correctly selected if you manually set the url to be
administrator/index.php?option=com_content&view=articles&filter[category_id]=2&filter[published]=1&filter[level]=1
If we look at the code in com_categories for generating the link
| <a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1&filter[level]=1'); ?>" aria-describedby="tip-publish<?php echo $i; ?>"> |
there is code for adding the view but $section is always empty
joomla-cms/administrator/components/com_categories/tmpl/categories/default.php
Lines 30 to 46 in 41cc761
| $extension = $this->escape($this->state->get('filter.extension')); | |
| $listOrder = $this->escape($this->state->get('list.ordering')); | |
| $listDirn = $this->escape($this->state->get('list.direction')); | |
| $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); | |
| $parts = explode('.', $extension, 2); | |
| $component = $parts[0]; | |
| $section = null; | |
| if (count($parts) > 1) { | |
| $section = $parts[1]; | |
| $inflector = Inflector::getInstance(); | |
| if (!$inflector->isPlural($section)) { | |
| $section = $inflector->toPlural($section); | |
| } | |
| } |
This block of code was added by @bembelimen way back in 3.5.1#9580
I think that was for something else whcih we see with fields where the urls has content=com_content.article but the important thing is that this bug is fixed by adding the correct view to the url
The important thing is that this is not something that can be fixed in the menu or the js as the problem is the missing view in the url from the category component
Version
5.4
Expected result
No response
Actual result
No response
System Information
No response
Additional Comments
also see #34067