Index: modules/menu/menu.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v retrieving revision 1.90 diff -u -p -r1.90 menu.admin.inc --- modules/menu/menu.admin.inc 20 Oct 2010 07:40:59 -0000 1.90 +++ modules/menu/menu.admin.inc 16 Dec 2010 05:29:23 -0000 @@ -328,7 +328,7 @@ function menu_edit_item($form, &$form_st // Generate a list of possible parents (not including this link or descendants). $options = menu_parent_options(menu_get_menus(), $item); - $default = $item['menu_name'] . ':' . $item['plid']; + $default = ($link['mlid'] ? $item['menu_name'] . ':' . $item['plid'] : 'main-menu:0'); if (!isset($options[$default])) { $default = 'navigation:0'; } Index: modules/menu/menu.install =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.install,v retrieving revision 1.26 diff -u -p -r1.26 menu.install --- modules/menu/menu.install 23 Aug 2010 23:38:06 -0000 1.26 +++ modules/menu/menu.install 16 Dec 2010 05:29:23 -0000 @@ -70,3 +70,22 @@ function menu_uninstall() { menu_rebuild(); } +/** + * Upgrade path for finer node menu controls (http://drupal.org/node/351249) + */ +function menu_update_7000() { + // Retain Drupal 6 menu setting for node parents or set all menus if such + // setting was not found (such as a previously running Drupal 7 site). + $d6_menu_setting = variable_get('menu_default_node_menu', NULL); + $menus = (is_null($d6_menu_setting) ? array_keys(menu_get_menus()) : array($d6_menu_setting)); + + // Store the menu setting for each node type. + $node_types = node_type_get_types(); + foreach($node_types as $key => $type) { + $type_menus = variable_get('menu_options_' . $key, NULL); + // Check with is_null() so we leave empty settings untouched, if present. + if (is_null($type_menus)) { + variable_set('menu_options_' . $key, $menus); + } + } +} Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.233 diff -u -p -r1.233 menu.module --- modules/menu/menu.module 24 Sep 2010 00:37:43 -0000 1.233 +++ modules/menu/menu.module 16 Dec 2010 05:29:24 -0000 @@ -648,9 +648,12 @@ function menu_form_node_form_alter(&$for ); $default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $type, 'main-menu:0')); - // @todo This will fail with the new selective menus per content type. + + // If the item is in a menu that is not permitted for this content type, + // allow it to stay there. if (!isset($options[$default])) { - $default = 'navigation:0'; + $all_options = menu_parent_options(menu_get_menus(), $link); + $options[$default] = $all_options[$default]; } $form['menu']['link']['parent'] = array( '#type' => 'select',