When a particular menu is set as the default for a content type, and a node of that type is edited, Drupal is supposed to select a menu entry from that menu in preference to other menu links to the node:
// Give priority to the default menu
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name AND module = 'menu' ORDER BY mlid ASC", 0, 1, array(
':path' => 'node/' . $node->nid,
':menu_name' => $menu_name,
))->fetchField();
The problem is that $menu_name contains a menu option 'main-menu:0' not a menu name 'main-menu'. This issue also impacts the default values that are provided, including new nodes.
Comments
Comment #1
lyricnz commentedPatch
Comment #2
sun$menu_name = explode(':' $menu_name);
$menu_name = $menu_name[0];
cuts it.
Powered by Dreditor.
Comment #3
sunEven better yet:
$menu_name = strtok($menu_name, ':');
Comment #4
lyricnz commentedThanks, Updated to use strtok().
Comment #5
lyricnz commentedThis fix is rolled into #761648: Menu D6->D7 upgrade doesn't maintain node-menu configuration (f.k.a.: Menu items disappear after upgrade or manual menu entry) which is RTBC, so I'll close this one as a duplicate.