this is reported at the page 2 of #942782: Custom menus never receive an active trail and still exists for Drupal 7.14.

As the comment #329 at http://drupal.org/node/942782?page=1 says:

in includes/menu.inc on line 2300
changed

$active = variable_get('menu_default_active_menus', array_keys(menu_list_system_menus()));

to

$active = variable_get('menu_default_active_menus', array_keys(menu_get_menus()));

will fix the problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yang_yi_cn’s picture

Basically this issue i18n / menu block related. Those modules depends on the core function to determine the active trail:

/**
 * Set (or get) the active menu for the current page - determines the active trail.
 *
 * @return
 *   An array of menu machine names, in order of preference. The
 *   'menu_default_active_menus' variable may be used to assert a menu order
 *   different from the order of creation, or to prevent a particular menu from
 *   being used at all in the active trail.
 *   E.g., $conf['menu_default_active_menus'] = array('navigation', 'main-menu')
 */
function menu_set_active_menu_names($menu_names = NULL) {
  $active = &drupal_static(__FUNCTION__);

  if (isset($menu_names) && is_array($menu_names)) {
    $active = $menu_names;
  }
  elseif (!isset($active)) {
    $active = variable_get('menu_default_active_menus', array_keys(menu_list_system_menus()));
  }
  return $active;
}

However, from this piece of code we can see clearly that this function only checks system menus for active trails, so any custom menus will be ignored thus causing the menu block doesn't show up. The issue was reported at #618700: Menu Block does not work with menu items pointing to the same destination

yang_yi_cn’s picture

This bugs happens for:

Drupal 7.14
Multilingual - Internationalization (i18n) 7.x-1.7
Menu Block (menu_block) 7.x-2.3

and a custom menu block pointing to a menu which has links to nodes, and nodes are translatable.

Symptom:
the custom menu block will not show up when you are visiting a node in the custom menu, while it suppose to show up.

Reason:
this is because the i18n / menu block module try to get the active menu trail and failed when the menu is custom, not system built-in menu.

yang_yi_cn’s picture

A temporary work around is to move your menu items to a system built-in menu, such as "navigation", when you need to show a menu block.

JBecker’s picture

Hello, my first post on drupal.org :)

I have had the same problem with Drupal 7.15 and Multilingual - Internationalization (i18n) 7.x-1.7 (activated submodule: Menu translation) But when i add $conf['menu_default_active_menus'] = array('my-custom-menu-name'); to settings.php all works fine.

The fix above worked for me too.

dgorton’s picture

BrockBoland’s picture

Version: 7.14 » 8.x-dev
Status: Needs review » Active

Need to determine if this bug exists in 8.x, because if so, it will need to be fixed there.

BrockBoland’s picture

Need to determine if this bug exists in 8.x, because if so, it will need to be fixed there.

BrockBoland’s picture

Version: 8.x-dev » 7.14

I take that back: this has been fixed in D8, and (apparently) in D7 too (#942782: Custom menus never receive an active trail).

Perhaps the better question: is this still an issue in 7.15?

MPeli’s picture

is this still an issue in 7.15?
Yes, it is.

pingers’s picture

Version: 7.14 » 8.x-dev

Given the same code exists in D8 for this function, guessing it's an issue in D8 (so leave in 8.x-dev). However, I couldn't reproduce the issue - I'm not very knowledgeable about Drupal multilingual though, so maybe I have a bad config - at least bad in terms of being able to reproduce the conditions needed.

In any case the piece of code highlighted should only determine a menu preference and not define the only menu's which can set the active trail.

jerrylow’s picture

This method (#4) works perfectly. A bit manual for my liking but whatever gets the job done.

chanderbhushan’s picture

I think $conf['menu_default_active_menus'] = array('my-custom-menu-name'); to settings.php this code has been fix your problem

feddovdm’s picture

At #8, yes it is. But the solution at the start works for me (issue summery) on drupal 7.15.

Thanks,

stefan.r’s picture

This module could also be used as workaround if anyone is having this issue but can't hack core:

https://drupal.org/project/ofed_menu_dam

stefan.r’s picture

Status: Active » Needs review
FileSize
483 bytes

Or as a core patch:

stefan.r’s picture

Version: 8.x-dev » 7.23

Status: Needs review » Needs work

The last submitted patch, drupal8.menu-system.1710744-15.patch, failed testing.

stefan.r’s picture

Status: Needs work » Needs review

Testbot ran tests against D8

stefan.r’s picture

Version: 7.23 » 8.x-dev
Issue summary: View changes
Issue tags: +Needs backport to D7, +Needs issue summary update, +Needs tests
stefan.r’s picture

Port to D8

jhedstrom’s picture

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

Needs a reroll and a test.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 20: drupal8.menu-system.1710744-18.patch, failed testing.

AjitS’s picture

Assigned: Unassigned » AjitS
Issue tags: +#punedrupalgroup, +#SprintWeekend2015

Will work on it now.

piyuesh23’s picture

Issue tags: -#SprintWeekend2015 +SprintWeekend2015
kristiaanvandeneynde’s picture

Is this still an issue? Seems fixed as per #8

AjitS’s picture

Assigned: AjitS » Unassigned

Yeah I think this is resolved, and not an issue. BTW, I had checked the issue and the patch is for a function which no longer exists in the core!
Forgot to mention it here, sorry about that.

jhedstrom’s picture

Status: Needs work » Closed (duplicate)
stefan.r’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Closed (duplicate) » Active

Is this still a problem in 7.x?

ruchirashree’s picture

I have tested the solution provided for Drupal 7.x, that is adding the this in settings.php file, but it is not working for me.
$conf['menu_default_active_menus'] = array('menu-header-menu');

Also I have tried to add the solution for Drupal7 using the D8 way, that too is not helping me.
$active = variable_get('menu_default_active_menus', array_keys(menu_get_menus()));

I tried with mentioned version of Drupal 7.x, Internationalization(i18n) 7.x-1.7 and Menu Block 7.x-2.3. It did not work for me.