As opposed to Core menu system, menu_link is not using the table "menu_link_content_data" to store information, which poses a problem when trying to use pathauto with the token "[node:menu-link:parents:join-path]" to generate the path for menu items.
I noticed this on a multilingual site, where menu_ui always gets the "original" node menu path, instead of the current node menu path.

How to reproduce:
- create a multilingual configuration (2 languages is enough)
- set [node:menu-link:parents:join-path] path pattern
- create 2 menus (one for each language)
- create 1 root node, translate it and add each translation to the corresponding menu. It's important that the title is different in order to observe the problem (ex: /root-fr and /root-en)
- create 1 child node, translate it and add it to the root node on each language.
Result: one of the child nodes (the translation) will have the wrong path (/root-fr/child-fr and /root-fr/child-en)

The solution would be to patch menu_ui, make menu_link use "menu_link_content_data" or create a menu_link token.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rmarques created an issue. See original summary.

rutiolma’s picture

Not sure if token is the best option, but it's the less invasive one.

rutiolma’s picture

Status: Active » Needs review
FileSize
4.03 KB
2.63 KB

Previous patch was not taking in consideration the fact that the user can create menu entries using the menu management interface.
I've updated it so the token will use the menu_link field by default and, if not set, it will check for a menu entry.

rutiolma’s picture

Status: Needs review » Needs work
FileSize
4.16 KB
926 bytes

New patch update fixing an issue when a page is not assigned to a menu.
This still need tests.

rutiolma’s picture

If you are using this patch, you may have to update pathauto safe tokens on version 1.3 and above.
More info @ https://www.drupal.org/project/pathauto/issues/3006242

vuil’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

I move the issue into 2.0.x-dev branch.

rutiolma’s picture

Status: Needs work » Needs review
FileSize
1.81 KB
4.22 KB

Updated patch, to work with 2.0.x, latest token module version and Drupal 10

Ludo.R’s picture

This patch is the same as #7, but adds an update hook to udpate:

  • Patterns using the old token, to replace it with the new one
  • Pathauto settings safe tokens to the old token with the new one
Ludo.R’s picture