We are using pathauto with tokens to provide an URL for our node's menu items. The URL is constructed in a "breadcrumbish" manner, so that the parent item's url is added to the beginning followed with the title of the node like so: [node:menu-link:parents:join-path]/[node:title]. We are using entity translation for translating our nodes.

So far we have encountered two problems with this approach:
In both cases the [node:menu-link:parents:join-path] remains untranslated.

  • When a parent node's menu item is disabled, it will not be translated. Due to the first if in the function
    _i18n_menu_link_process (i18n_menu.module, line 520):
    if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && empty($link['hidden']) && i18n_menu_mode($link['menu_name']))
  • The second issue is even more alarming. When editing a node placed in a menu and creating a new automatic alias the translation is skipped because of the administration skip check in the same function (i18n_menu.module, line 533): elseif (arg(0) == 'node' && arg(2) == 'edit'). The comment says "Skip if administering this menu item through the node edit form.", which in our case is not valid, as we are on a different node that is been edited.

We have been able to quick-fix the issue by commenting out/removing the checks but it's, of course, a hack. Could you shed some light why these checks exist and how we can tackle the issue without breaking something else (and hacking the module)?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anairamzap’s picture

arrubiu’s picture

Today I was going crazy with the second issue.
After debugging I found the function in i18n_menu.

Why node/%nid/edit is excluded?

The second issue is not related to pathauto, maybe should be added as new issue.

mfernea’s picture

I also have problems with the code in _i18n_menu_link_process function. It's meant to hide menu links that should not be shown in front-end.
But we ran into all sorts of problems when nodes are loaded and get saved in cron or other admin sections. The language might be different than the node language so the menu link gets hidden and then saved, making the menu link disabled for good.

villette’s picture

I am stuck because of the first issue, so I've made a patch. I don't know if it will be committed but it works for me.

clairedesbois@gmail.com’s picture

Status: Active » Fixed

This issue should be closed, the modification is now present in the module.

joseph.olstad’s picture

@Calystod thanks for the update.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.