Error when the menu contains a link to a taxonomy term page

Created on 29 November 2021, over 3 years ago
Updated 31 March 2024, about 1 year ago

Reproducing

  • Under Drupal 8.9.19, go to a taxonomy page in BO
  • Copy the URL of any of the existing terms
  • Paste this URL as link for a new menu item entry
  • In module settings (/admin/config/user-interface/menu-manipulator), check the boxes "Automatically filter menus by current's user language" and "Use referenced entity's language to filter menus by current's user language clear cache"
  • Clear cache and check in front

Issue details

A link to a taxonomy term is now /taxonomy/term/{id}. If we consider the URL /taxonomy/term/10, actual behavior leads to define variables $entity_type = 'taxonomy' and $entity_id = 'term' while we should have $entity_type = 'taxonomy_term' and $entity_id = 10.

Proposed solution

Using router to find entity from URL when possible (patch proposed)
[EDIT] actually this solution is not working, router might return a route related to a view rather than the entity route.

Remaining tasks

Check with other kind of entities

I apologize if I made any mistake it's my first time declaring an issue.

Thanks in advance for your feedback.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024