diff options
Diffstat (limited to 'modules/menu')
-rw-r--r-- | modules/menu/menu.admin.inc | 2 | ||||
-rw-r--r-- | modules/menu/menu.install | 43 | ||||
-rw-r--r-- | modules/menu/menu.module | 3 |
3 files changed, 46 insertions, 2 deletions
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 1f3c4f728..7b5882c53 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -678,7 +678,7 @@ function menu_configure() { '#empty_option' => t('No Secondary links'), '#options' => $menu_options, '#tree' => FALSE, - '#description' => t('Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links.', array('%main' => $menu_options[$main])), + '#description' => t('Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links.', array('%main' => $main ? $menu_options[$main] : 'none')), ); return system_settings_form($form); diff --git a/modules/menu/menu.install b/modules/menu/menu.install index 05aed283f..717c5e712 100644 --- a/modules/menu/menu.install +++ b/modules/menu/menu.install @@ -69,3 +69,46 @@ function menu_uninstall() { menu_rebuild(); } +/** + * @defgroup updates-7.x-extra Extra updates for 7.x + * @{ + */ + +/** + * Migrate the "Default menu for content" setting to individual node types. + */ +function menu_update_7000() { + // Act only on sites originally on Drupal 6 that have a custom "Default menu + // for content" setting. + $default_node_menu = variable_get('menu_default_node_menu'); + if (isset($default_node_menu)) { + // Remove variable no longer used in Drupal 7. + variable_del('menu_default_node_menu'); + + // Make sure the menu chosen as the default still exists. + $defined_menus = db_query('SELECT * FROM {menu_custom}')->fetchAllAssoc('menu_name', PDO::FETCH_ASSOC); + // If the menu does not exist, do nothing; nodes will use the default D7 + // node menu settings. + if (!isset($defined_menus[$default_node_menu])) { + return; + } + + // Update the menu settings for each node type. + foreach (_update_7000_node_get_types() as $type => $type_object) { + $type_menus = variable_get('menu_options_' . $type); + // If the site already has a custom menu setting for this node type (set + // on the initial upgrade to Drupal 7.0), don't override it. + if (!isset($type_menus)) { + // Set up this node type so that the Drupal 6 "Default menu for content" + // is still available in the "Menu settings" section. + variable_set('menu_options_' . $type, array($default_node_menu)); + variable_set('menu_parent_' . $type, $default_node_menu . ':0'); + } + } + } +} + +/** + * @} End of "defgroup updates-7.x-extra" + * The next series of updates should start at 8000. + */ diff --git a/modules/menu/menu.module b/modules/menu/menu.module index fc8f68a6c..254079700 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -246,7 +246,8 @@ function menu_load_all() { * * @param $menu * An array representing a custom menu: - * - menu_name: The unique name of the custom menu. + * - menu_name: The unique name of the custom menu (composed of lowercase + * letters, numbers, and hyphens). * - title: The human readable menu title. * - description: The custom menu description. * |