diff --git a/core/modules/block/block.install b/core/modules/block/block.install index ee72e0fa2c2..56b91c3ba90 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -323,6 +323,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 4eb76833ff6..b09f2d4664d 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 @@ class BlockTest extends WebTestBase { // 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 df2ba1ab4eb..bbb00e8c69b 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 a9c2c36c2bb..570cb26260b 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -691,6 +691,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 b9df6a3f408..e4ecbfc3ed9 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 @@ class BreadcrumbTest extends MenuTestBase { 'status' => 1, )) ->condition('module', 'system') - ->condition('delta', 'tools') + ->condition('delta', 'menu-tools') ->execute(); } @@ -354,7 +354,7 @@ class BreadcrumbTest extends MenuTestBase { // ('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 72bcf3f203f..a55004835e2 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 @@ class RouterTest extends WebTestBase { 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 66c6ff89cb1..21ae3f97716 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 @@ class TrailTest extends MenuTestBase { '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 @@ class TrailTest extends MenuTestBase { 'status' => 1, )) ->condition('module', 'system') - ->condition('delta', 'admin') + ->condition('delta', 'menu-admin') ->execute(); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php index 4e12d7b196e..e1df73e26dc 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php @@ -43,6 +43,16 @@ class FilledStandardUpgradePathTest extends UpgradePathTestBase { $this->drupalGet(''); $this->assertResponse(200); + // Verify that the former Navigation system menu block appears as Tools. + $this->assertText(t('Tools')); + + // Verify that the Account menu still appears as secondary links source. + $this->assertText(t('My account')); + $this->assertText(t('Log out')); + + // Verify the the Main menu still appears as primary links source. + $this->assertLink(t('Home')); + // Verify that we are still logged in. $this->drupalGet('user'); $this->clickLink(t('Edit')); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a9d951b8c88..7f9f33a3f52 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 a25fdecae33..4e42e6d1242 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 87fb69fe8c9..b4dc761ab71 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,