Index: local_menu/local_menu.module =================================================================== --- local_menu/local_menu.module (revision 108) +++ local_menu.module (working copy) @@ -20,6 +20,12 @@ switch ($op) { case 'configure': + $form['local_menu_default_menu'] = array( + '#type' => 'textfield', + '#title' => t('Default Menu'), + '#description' => t('Enter the computer readable name for the menu this block should display if an item shows up in more than one menu. By default this is set to "primary-links".'), + '#default_value' => variable_get('local_menu_default_menu', 'primary-links'), + ); $form['local_menu_start'] = array( '#type' => 'select', '#title' => t('Starting depth'), @@ -52,6 +58,7 @@ case 'save': variable_set('local_menu_start', $edit['local_menu_start']); + variable_set('local_menu_default_menu', $edit['local_menu_default_menu']); variable_set('local_menu_depth', $edit['local_menu_depth']); return; @@ -72,6 +79,12 @@ // Get the menu link and set the active menu to the menu it's in, so Drupal can find it's way and make correct breadcrumbs at the same time $link = menu_link_load(db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND hidden <> 1", $item['href']))); + $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND hidden <> 1 AND menu_name = '%s'", $item['href'], variable_get('local_menu_default_menu', 'primary-links'))); + if ($mlid) { + $link = menu_link_load($mlid); + } else { + $link = menu_link_load(db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND hidden <> 1 AND menu_name != 'admin_menu'", $item['href']))); + } menu_set_active_menu_name($link['menu_name']); // Set current path temporarily to the root of the possible local task we might be, so Drupal finds it's way