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/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 4eb7683..b09f2d4 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -322,7 +322,7 @@ function testBlock() { // Select the Administration menu block to be configured and moved. $block = array(); $block['module'] = 'system'; - $block['delta'] = 'admin'; + $block['delta'] = 'menu-admin'; $block['title'] = $this->randomName(8); // Set block title to confirm that interface works and override any custom titles. diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index df2ba1a..bbb00e8 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -128,7 +128,7 @@ function contextual_preprocess(&$variables, $hook) { * menu_contextual_links(). For example: * @code * array('#contextual_links' => array( - * 'block' => array('admin/structure/block/manage', array('system', 'tools')), + * 'block' => array('admin/structure/block/manage', array('system', 'menu-tools')), * 'menu' => array('admin/structure/menu/manage', array('tools')), * )) * @endcode 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/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php index b9df6a3..e4ecbfc 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php @@ -46,7 +46,7 @@ function setUp() { 'status' => 1, )) ->condition('module', 'system') - ->condition('delta', 'tools') + ->condition('delta', 'menu-tools') ->execute(); } @@ -354,7 +354,7 @@ function testBreadCrumbs() { // ('taxonomy/term/%') should never be translated and appear in any menu // other than the breadcrumb trail. $elements = $this->xpath('//div[@id=:menu]/descendant::a[@href=:href]', array( - ':menu' => 'block-system-tools', + ':menu' => 'block-system-menu-tools', ':href' => url($link['link_path']), )); $this->assertTrue(count($elements) == 1, "Link to {$link['link_path']} appears only once."); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php index 72bcf3f..a550048 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -45,7 +45,7 @@ function setUp() { db_merge('block') ->key(array( 'module' => 'system', - 'delta' => 'tools', + 'delta' => 'menu-tools', 'theme' => 'bartik', )) ->fields(array( diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php index 66c6ff8..21ae3f9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php @@ -43,7 +43,7 @@ function setUp() { 'status' => 1, )) ->condition('module', 'system') - ->condition('delta', 'tools') + ->condition('delta', 'menu-tools') ->execute(); // This test puts menu links in the Administration menu and then tests for @@ -56,7 +56,7 @@ function setUp() { 'status' => 1, )) ->condition('module', 'system') - ->condition('delta', 'admin') + ->condition('delta', 'menu-admin') ->execute(); } 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])) { diff --git a/core/profiles/minimal/minimal.install b/core/profiles/minimal/minimal.install index a25fdec..4e42e6d 100644 --- a/core/profiles/minimal/minimal.install +++ b/core/profiles/minimal/minimal.install @@ -28,7 +28,7 @@ function minimal_install() { ), array( 'module' => 'system', - 'delta' => 'tools', + 'delta' => 'menu-tools', 'theme' => $default_theme, 'status' => 1, 'weight' => 0, @@ -38,7 +38,7 @@ function minimal_install() { ), array( 'module' => 'system', - 'delta' => 'management', + 'delta' => 'menu-admin', 'theme' => $default_theme, 'status' => 1, 'weight' => 1, diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 87fb69f..b4dc761 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -110,7 +110,7 @@ function standard_install() { ), array( 'module' => 'system', - 'delta' => 'tools', + 'delta' => 'menu-tools', 'theme' => $default_theme, 'status' => 1, 'weight' => 0,