Override the menu links on the pre render instead the preprocess

Created on 5 September 2024, 4 months ago

Problem/Motivation

We have a multi-language menu with an item pointing to a node. When accessing a specific language where the node is not translated, the link does not appear because the menu_multilingual module filters it out. This is the expected behavior. However, with the translatable_menu_link_uri module, we are overwriting the link in the language where it does not appear with an external URL, so it should not consider the unpublished node condition.

Steps to reproduce

  1. Create a multi-language menu in Drupal.
  2. Add a menu item pointing to a node.
  3. Ensure the node is not translated into a specific target language.
  4. Enable the menu_multilingual module and the translatable_menu_link_uri module.
  5. Configure the menu item so the link points to an external URL in the targeted language.
  6. Try to access the menu in the language where the node is not translated.

Proposed resolution

The menu_multilingual module hooks into the pre-render phase, whereas translatable_menu_link_uri hooks into the preprocess phase. To resolve this issue, it is suggested that the menu link be altered in the pre-render phase.

Feature request
Status

Active

Version

2.1

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024