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.
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.
Comments
Comment #1
xjmComment #2
xjmThis will need to be updated to use the constant
MENU_LINK_PREFERRED
.Comment #3
caktux CreditAttribution: caktux commentedComment #4
oriol_e9gOnly file rename for testbot.
Edit: Ops! I have not see that we are in the Internationalization project.
Comment #5
webflo CreditAttribution: webflo commentedTriggering testbot.
Comment #7
webflo CreditAttribution: webflo commentedRerolled against current HEAD.
Comment #8
webflo CreditAttribution: webflo commentedTriggering testbot.
Comment #9
batigol CreditAttribution: batigol commentedhttp://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.
Comment #10
batigol CreditAttribution: batigol commentedWith Drupal 7.4 (update.php, clear cache).
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>
:)Comment #11
HnLn CreditAttribution: HnLn commentedthis patch solved a problem with menu_block for me (http://drupal.org/node/1425342)
Comment #12
sense-designConfirming #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
Comment #13
mostou CreditAttribution: mostou commentedConfirming #11 as well.
Comment #14
webflo CreditAttribution: webflo commentedCommit 48d157f on 7.x-1.x
Thanks!
Comment #15
RichardB-dupe2 CreditAttribution: RichardB-dupe2 commented#7: i18n-menu-active-trail-custom-menus-1351678-7.patch queued for re-testing.
Comment #17
xjmThe 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.
Comment #18
Eric_A CreditAttribution: Eric_A commentedErhm,
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?
Comment #19
hatuhay CreditAttribution: hatuhay commentedNotice: 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
Comment #20
batigol CreditAttribution: batigol commented@hatuhay #10 same in drupal 7.4
Drupal 7.12 like you have said solves the problem.
Comment #21
spynode CreditAttribution: spynode commentedWith 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?
Comment #22
f4o CreditAttribution: f4o commentedI 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!
Comment #23
batigol CreditAttribution: batigol commented@spynode, are you using some additional menu modules (like http://drupal.org/project/menu_block)?
Comment #24
spynode CreditAttribution: spynode commented#23 Yes, I use Taxonomy Menu + DHTML Menu. After page reload menu always is closed. Problem doesn't occur without Translate Menu module enabled.
Comment #25
batigol CreditAttribution: batigol commented@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).
Comment #26
spynode CreditAttribution: spynode commented@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.
Comment #27
batigol CreditAttribution: batigol commentedMaybe you did use some patch from http://drupal.org/node/942782 and need to take them back before upgrade to 7.12 ?
Comment #28
colanMarking the following as duplicates:
Comment #29
fretje CreditAttribution: fretje commentedI 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.
Comment #30
bvanmeurs CreditAttribution: bvanmeurs commentedOnly 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?
Comment #31
vegardjo CreditAttribution: vegardjo commentedExperiencing 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.
Comment #32
colanThat's a separate isssue. See #1425342: Drupal core upgrade from 7.10 to 7.12 causes menu block to fail instead.
Comment #33
vegardjo CreditAttribution: vegardjo commentedThanks 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.
Comment #34
colanI'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.
Comment #35
mgiffordI'm having trouble with Menu block & 7.12, but just installed it and haven't verified that this is the issue.
Comment #36
vegardjo CreditAttribution: vegardjo commented@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!
Comment #37
mgiffordI 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.
Comment #38
rypit CreditAttribution: rypit commentedConfirming that #25 seems to solve the problem with Menu Block. Running as desired with the following:
Comment #40
mgiffordWell.. Pretty sure it's not fixed. Bad bot!
Comment #41
klonosThis 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 ;)
Comment #42
mgiffordOk, sorry.
Comment #43
klonosBack in #40 you say that you're pretty sure the issue is not fixed. What made you say that?
Comment #44
mgiffordI 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.
Comment #45
tangent CreditAttribution: tangent commentedI 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?
Comment #46
svdhout CreditAttribution: svdhout commentedFor 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.