Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tagged items URLs for items with the same view #43379

Open
wants to merge 2 commits into
base: 5.1-dev
Choose a base branch
from

Conversation

AlterBrains
Copy link
Contributor

Summary of Changes

"Tags > List of tagged items" view uses Joomla\Component\Tags\Site\Helper\RouteHelper::getItemRoute() to get a URL of individual item.

It uses Joomla\CMS\Helper\RouteHelper::getRoute(), if no JPATH_BASE . '/components/' . $explodedAlias[0] . '/helpers/route.php' is found.

Assuming that we have modern components with Router service, the tagged item URL is generated via Joomla\CMS\Helper\RouteHelper::getRoute().

This method adds the Itemid via this code:

        if ($item = $this->findItem($needles)) {
            $link .= '&Itemid=' . $item;
        }

The problem is that the new routers are using the NoMenuRule and can auto-find the correct Itemid themselves.

Hence, there is no need to auto-find the Itemid here.

Another problem is that Joomla\CMS\Helper\RouteHelper::findItem() uses internal static cache of needles per view name.

Hence, if we have multiple components with the same view name, the second component will receive invalid Itemid because its URL generation will use the needles cache of the first component with the same view name.

Testing Instructions

Create multiple tagged items from different component but with the same view name.

Actual result BEFORE applying this Pull Request

See broken URLs if you browser the list of tagged items where we have the items from different components but the same view.

Expected result AFTER applying this Pull Request

Correct URLs respecting the components' specific Itemids.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants