There might be upcoming changes to menu_link_get_preferred's static cache following #942782: Custom menus never receive an active trail.
Adding a patch to copy it's current state.

Files: 
CommentFileSizeAuthor
#4 i18n-menu-active-trail-custom-menus-1351678.patch2.52 KBoriol_e9g
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-menu-active-trail-custom-menus-1351678.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#7 i18n-menu-active-trail-custom-menus-1351678-7.patch2.64 KBwebflo
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-menu-active-trail-custom-menus-1351678-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#3 i18n_menu_active_trail_custom_menus-MENU_PREFERRED_LINK.patch2.52 KBcaktux
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n_menu_active_trail_custom_menus-MENU_PREFERRED_LINK.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#3 interdiff-MENU_PREFERRED_LINK-0-3.txt1.14 KBcaktux
i18n_menu_active_trail_custom_menus.patch2.51 KBcaktux
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n_menu_active_trail_custom_menus.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

Status:Active» Needs review

Status:Needs review» Needs work

This will need to be updated to use the constant MENU_LINK_PREFERRED.

Status:Needs work» Needs review
StatusFileSize
new1.14 KB
new2.52 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n_menu_active_trail_custom_menus-MENU_PREFERRED_LINK.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

StatusFileSize
new2.52 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-menu-active-trail-custom-menus-1351678.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Only file rename for testbot.

Edit: Ops! I have not see that we are in the Internationalization project.

Triggering testbot.

Status:Needs review» Needs work

The last submitted patch, i18n-menu-active-trail-custom-menus-1351678.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new2.64 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-menu-active-trail-custom-menus-1351678-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Rerolled against current HEAD.

Triggering testbot.

http://drupal.org/node/1414920 - I did have some time tonight but cause of http://drupal.org/node/1410004 I couldn't even install latest version of i18n.

With Drupal 7.4 (update.php, clear cache).

  • Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' in i18n_menu_init() (line 783 of C:\xampp\htdocs\drupal\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
  • Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' in i18n_menu_init() (line 821 of C:\xampp\htdocs\drupal\sites\all\modules\i18n\i18n_menu\i18n_menu.module).
  • Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' in i18n_menu_init() (line 823 of C:\xampp\htdocs\drupal\sites\all\modules\i18n\i18n_menu\i18n_menu.module).

Drupal 7.12

Everything is FINE! Menu IS WORKING like it always should :P

@webflo Just test Drupal 7.12 with i18n module without this patch. Maybe it's not needed anymore...

"Drupal 7.12, 2012-02-01
----------------------
- Fixed bug preventing custom menus from receiving an active trail."

Patch is needed to display menu subitems properly.

LOL I have discovered that <del> dosen't work when there is " inside </del> :)

this patch solved a problem with menu_block for me (http://drupal.org/node/1425342)

Confirming #11

Patch menu_block: http://drupal.org/node/1425342#comment-5549484
Patch i18n: http://drupal.org/node/1351678#comment-5498090

Apply these 2 patches and menu_block and i18n work well with 7.12

Confirming #11 as well.

Status:Needs review» Fixed
Issue tags:+Needs tests

Commit 48d157f on 7.x-1.x
Thanks!

Status:Fixed» Needs review
Issue tags:-Needs tests

Status:Needs review» Needs work
Issue tags:+Needs tests

The last submitted patch, i18n-menu-active-trail-custom-menus-1351678-7.patch, failed testing.

Status:Needs work» Fixed

The patch has already been committed. Therefore, there is no need to re-test it. Trying to test it will in fact fail--it can't be applied because it is already there.

Erhm,

I just heard this leads to fatal errors when upgrading i18n, when Drupal < 7.12 builds a breadcrumb. Perhaps declaring a dependency can help prevent this upgrade?

Version:7.x-1.x-dev» 7.x-1.4

Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' en i18n_menu_init() (línea 786 de /sites/all/modules/i18n/i18n_menu/i18n_menu.module).
Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' en i18n_menu_init() (línea 786 de /sites/all/modules/i18n/i18n_menu/i18n_menu.module).
Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' en i18n_menu_init() (línea 786 de /sites/all/modules/i18n/i18n_menu/i18n_menu.module).

Drupal 7.10, i18n 7x-1.4
Upgrade to Drupal 7.12 solves the problem

@hatuhay #10 same in drupal 7.4

Drupal 7.12 like you have said solves the problem.

With Drupal 7.12 and i18n module 7.x-1.4 active menu trails in custom menus still won't work. After turning off Menu Translation module, active menu trails work as they should. Am I the only one experiencing this?

I upgraded Drupal from 7.10 -> 7.12 and error

Notice: Use of undefined constant MENU_PREFERRED_LINK - assumed 'MENU_PREFERRED_LINK' u i18n_menu_init() (line 786 from /home/retrumho/public_html/sites/all/modules/contrib/i18n/i18n_menu/i18n_menu.module).

was solved!

@spynode, are you using some additional menu modules (like http://drupal.org/project/menu_block)?

#23 Yes, I use Taxonomy Menu + DHTML Menu. After page reload menu always is closed. Problem doesn't occur without Translate Menu module enabled.

@spynode, I have no idea.

Drupal 7.12 + i18n 7.x-1.4 + update.php + clear cache should fix problem with menus. Try to disable additional menu modules (or upgrade them).

@batigol Tried to regenerate taxonomy menu, and cleared cache. Update script showed that no updates where available. After loading a certain page menu still is closed and no active trail is added to it. After disabling Menu Translate module, active trail is added and menu is open all the way to the particular link of the page.

Maybe you did use some patch from http://drupal.org/node/942782 and need to take them back before upgrade to 7.12 ?

I can confirm what @spynode said in #26. I have the same problem.

Drupal 7.12 with i18n 1.4

When I enable the "Menu Translation" module, the submenu's are gone.
When I disable it, they're back again.
No other menu-related modules are enabled.

Only good solution is a query alter hook there.. Code duplication gives these kind of problems! Have you issued a feature request and lobbied for this with the core menu module maintainers?

Experiencing the same as spynode in #26 and fretje in #29. Drupal 7.12, Menu Block and Menu Translation enabled, all up to date.

The menu block with sub-menu items appears fine for my Main menu, but equal block does *not* appear for a custom menu I have built. If I disable Menu Translation the menu block appears again.

Thanks colan, but are you sure? That was the issue that sent me to this one: "Turn off Menu translation submodule to check if its i18n fault". (comment #9 and #10 there).

Menu Block works as it should until I turn Menu Translation on, then it fails on custom menus.

BTW: this is a site buildt fresh on Drupal 7.12, Internationalization 1.4 and Menu Block 2.3, no upgrades involved.

I'm not sure, but I'm not using Menu Block, and I don't have any of these problems. I noticed other folks were though.

I'm having trouble with Menu block & 7.12, but just installed it and haven't verified that this is the issue.

@colan and all, my problem was actually the fact that this site was built from scratch on 7.12, and a necessary db update from 7.11 isn't executed then, see #1447466: Active menu trail breaks (menu_update_7003 creates inconsistencies). - so the problem is actually in core, not i18n or Menu Block!

I ran that manually and id didn't seem to fix it. This is for a Drupal 7.10 upgrade without Menu Block. I added Menu Block after 7.12 had been installed. I can get primary menus to work fine, but not the secondary menus.

Confirming that #25 seems to solve the problem with Menu Block. Running as desired with the following:

  • Drupal 7.12
  • Multilingual - Internationalization (i18n) 7.x-1.4
  • Menu Block (menu_block) 7.x-2.3

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

Well.. Pretty sure it's not fixed. Bad bot!

This was set to "fixed" back in #17. The bot simply did its job and closed the issue after 2 weeks as it's supposed to. Good bot ;)

Status:Active» Fixed

Ok, sorry.

Status:Fixed» Closed (fixed)

Back in #40 you say that you're pretty sure the issue is not fixed. What made you say that?

I was scanning through my list of issues and usually when the bot marks an issue closed(fixed) it's within the first few after the post. I guess I just didn't go all the way up to 17. That and being tired.. Been working too much this month.

Issue tags:+needs backport to D6

I believe this issue also exists in i18nmenu 6.x-1.10 because I'm seeing identical misbehavior. Is there any chance this fix can be backported?

For me this problem still occurs when using a custom menu as menu_main_links_source.

A custom menu doesn't get returned by menu_get_active_menu_names(). Thus the menu candidate is set to the main-menu.

The issue can be solved by adding the menu_main_links_source to menu_default_active_menus.

<?php
  $menus
= array_keys(menu_list_system_menus());
 
$main_menu = variable_get('menu_main_links_source');
 
array_unshift($menus, $main_menu);
 
$conf['menu_default_active_menus'] = $menus;
?>