diff --git a/core/modules/block/block.install b/core/modules/block/block.install index ee72e0f..56b91c3 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -324,6 +324,36 @@ function block_update_8003() { } /** + * Rename default menu names. + */ +function block_update_8004() { + // System menu's new block deltas are prefixed with 'menu-'. + $map = array( + 'navigation' => 'menu-tools', + 'management' => 'menu-admin', + 'user-menu' => 'menu-account', + 'main-menu' => 'menu-main', + ); + foreach ($map as $old => $new) { + db_update('block') + ->condition('module', 'system') + ->condition('delta', $old) + ->fields(array('delta' => $new)) + ->execute(); + db_update('block_language') + ->condition('module', 'system') + ->condition('delta', $old) + ->fields(array('delta' => $new)) + ->execute(); + db_update('block_role') + ->condition('module', 'system') + ->condition('delta', $old) + ->fields(array('delta' => $new)) + ->execute(); + } +} + +/** * @} End of "addtogroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ diff --git a/core/modules/node/node.install b/core/modules/node/node.install index a9c2c36..570cb26 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -692,6 +692,26 @@ function node_update_8007() { } /** + * Rename default menu names. + */ +function node_update_8008() { + // System menu's new block deltas are prefixed with 'menu-'. + $map = array( + 'navigation' => 'menu-tools', + 'management' => 'menu-admin', + 'user-menu' => 'menu-account', + 'main-menu' => 'menu-main', + ); + foreach ($map as $old => $new) { + db_update('block_node_type') + ->condition('module', 'system') + ->condition('delta', $old) + ->fields(array('delta' => $new)) + ->execute(); + } +} + +/** * @} End of "addtogroup updates-7.x-to-8.x" * The next series of updates should start at 9000. */ diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a9d951b..7f9f33a 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2515,11 +2515,13 @@ function system_block_info() { 'status' => 1, ); // System-defined menu blocks. + // The block deltas need to be prefixed with 'menu-', since the 'main' menu + // would otherwise clash with the 'main' page content block defined above. foreach (menu_list_system_menus() as $menu_name => $title) { - $blocks[$menu_name]['info'] = t($title); + $blocks['menu-' . $menu_name]['info'] = t($title); // Menu blocks can't be cached because each menu item can have // a custom access callback. menu.inc manages its own caching. - $blocks[$menu_name]['cache'] = DRUPAL_NO_CACHE; + $blocks['menu-' . $menu_name]['cache'] = DRUPAL_NO_CACHE; } return $blocks; } @@ -2546,6 +2548,8 @@ function system_block_view($delta = '') { $block['content'] = menu_get_active_help(); return $block; default: + // Strip off 'menu-' prefix from block delta. + $delta = substr($delta, 5); // All system menu blocks. $system_menus = menu_list_system_menus(); if (isset($system_menus[$delta])) {