Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem:
I created some menu item with different language, and they link to the same node corresponding language.
Then I access the node, other menus (link same node, different language) also active.
Reproduce step:
- Create two menu item with different language.
- EN Example (link. /demo
) (not have JP translation)
- JP Example (link. /jp/demo
) (not have EN translation)
- Access /jp/demo
path.
Solution:
I think we should filter menu link content by current language. I created a patch for this issue.
Comment | File | Size | Author |
---|---|---|---|
#11 | 3082857-11.patch | 5.18 KB | burnellw_cit |
#9 | 3082857-9.patch | 4.24 KB | Suresh Prabhu Parkala |
#3 | 3082857-3.patch | 3.65 KB | ravi.shankar |
| |||
Frontend.png | 33.07 KB | Oscaner | |
JP Example.png | 16.43 KB | Oscaner |
Comments
Comment #2
BerdirPatch doesn't apply anymore.
Comment #3
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere is a re-roll of above patch.
Comment #4
BerdirI don't think this behavior is consistent with core, which is why I'm unsure about adding this. Drupal core shows unrelated menu links for other languages, it just treats it as missing translation and falls back.
Comment #5
Oscaner CreditAttribution: Oscaner at CI&T commentedBased on this issue Performance issues when having high amount of menu items.
I did some work for menu trail by path, to support multi-language menus.
Comment #6
Oscaner CreditAttribution: Oscaner at CI&T commentedBased on #2910494 latest patch.
Comment #7
Oscaner CreditAttribution: Oscaner at CI&T commentedBased on #2910494 latest patch.
Comment #8
BerdirNeeds work after that other issue has been committed.
Comment #9
Suresh Prabhu Parkala CreditAttribution: Suresh Prabhu Parkala at Specbee commentedRe-rolled the patch against the latest 2.x.
Comment #10
BerdirI'm assuming that this is used in combination with core patches to respect the menu link translation status because as mentioned before, core doesn't do that right now and I'm hesitant to include this before a core patch is committed.
Even then, this might not always be the expected behavior when translations are missing, should probably still return *something*
The patch also needs some coding standard improvements (indendation seems off) and $menu as a variable name is confusing, should probably be $menu_link_content.
Comment #11
burnellw_cit CreditAttribution: burnellw_cit commented