Commit 9fa17253 authored by Dries's avatar Dries

Issue #594660 by sun, jenlampton, dagmar, yoroy, no_commit_credit: rename default menu names.

parent 22050700
......@@ -1751,10 +1751,10 @@ function menu_set_custom_theme() {
*/
function menu_list_system_menus() {
return array(
'navigation' => 'Navigation',
'management' => 'Management',
'user-menu' => 'User menu',
'main-menu' => 'Main menu',
'tools' => 'Tools',
'admin' => 'Administration',
'account' => 'User account menu',
'main' => 'Main navigation',
);
}
......@@ -1765,7 +1765,7 @@ function menu_main_menu() {
$config = config('menu.settings');
$menu_enabled = module_exists('menu');
// When menu module is not enabled, we need a hardcoded default value.
$main_links_source = $menu_enabled ? $config->get('main_links') : 'main-menu';
$main_links_source = $menu_enabled ? $config->get('main_links') : 'main';
return menu_navigation_links($main_links_source);
}
......@@ -1776,8 +1776,8 @@ function menu_secondary_menu() {
$config = config('menu.settings');
$menu_enabled = module_exists('menu');
// When menu module is not enabled, we need a hardcoded default value.
$main_links_source = $menu_enabled ? $config->get('main_links') : 'main-menu';
$secondary_links_source = $menu_enabled ? $config->get('secondary_links') : 'user-menu';
$main_links_source = $menu_enabled ? $config->get('main_links') : 'main';
$secondary_links_source = $menu_enabled ? $config->get('secondary_links') : 'account';
// If the secondary menu source is set as the primary menu, we display the
// second level of the primary menu.
......@@ -2109,7 +2109,7 @@ function menu_local_tasks($level = 0) {
* @param $args
* A list of dynamic path arguments to append to $parent_path to form the
* fully-qualified menu router path, for example array(123) for a certain
* node or array('system', 'navigation') for a certain block.
* node or array('system', 'tools') for a certain block.
*
* @return
* A list of menu router items that are local tasks for the passed-in path.
......@@ -2267,7 +2267,7 @@ function theme_menu_local_tasks(&$variables) {
* 'menu_default_active_menus' variable may be used to assert a menu order
* different from the order of creation, or to prevent a particular menu from
* being used at all in the active trail.
* E.g., $conf['menu_default_active_menus'] = array('navigation', 'main-menu')
* E.g., $conf['menu_default_active_menus'] = array('tools', 'main')
*/
function menu_set_active_menu_names($menu_names = NULL) {
$active = &drupal_static(__FUNCTION__);
......@@ -2615,7 +2615,7 @@ function menu_link_load($mlid) {
/**
* Clears the cached cached data for a single named menu.
*/
function menu_cache_clear($menu_name = 'navigation') {
function menu_cache_clear($menu_name = 'tools') {
cache('menu')->invalidateTags(array('menu' => $menu_name));
// Also clear the menu system static caches.
menu_reset_static_cache();
......@@ -2749,7 +2749,7 @@ function _menu_link_build($item) {
// the menu links generated automatically from entries in {menu_router}.
$item['module'] = 'system';
$item += array(
'menu_name' => 'navigation',
'menu_name' => 'tools',
'link_title' => $item['title'],
'link_path' => $item['path'],
'hidden' => 0,
......@@ -2996,7 +2996,7 @@ function _menu_delete_item($item, $force = FALSE) {
* normalized first by calling drupal_get_normal_path() on it.
* - link_title: (required) Title to appear in menu for the link.
* - menu_name: (optional) The machine name of the menu for the link.
* Defaults to 'navigation'.
* Defaults to 'tools'.
* - weight: (optional) Integer to determine position in menu. Default is 0.
* - expanded: (optional) Boolean that determines if the item is expanded.
* - options: (optional) An array of options, see l() for more.
......@@ -3023,7 +3023,7 @@ function menu_link_save(&$item, $existing_item = array(), $parent_candidates = a
$item['external'] = (url_is_external($item['link_path']) || $item['link_path'] == '<front>') ? 1 : 0;
// Load defaults.
$item += array(
'menu_name' => 'navigation',
'menu_name' => 'tools',
'weight' => 0,
'link_title' => '',
'hidden' => 0,
......
......@@ -319,10 +319,10 @@ function testBlockVisibilityPerUser() {
* Test configuring and moving a module-define block to specific regions.
*/
function testBlock() {
// Select the Navigation block to be configured and moved.
// Select the Administration menu block to be configured and moved.
$block = array();
$block['module'] = 'system';
$block['delta'] = 'management';
$block['delta'] = 'admin';
$block['title'] = $this->randomName(8);
// Set block title to confirm that interface works and override any custom titles.
......@@ -354,13 +354,13 @@ function testBlock() {
$xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-block-' . $bid));
$this->assertNoFieldByXPath($xpath, FALSE, 'Custom block found in no regions.');
// For convenience of developers, put the navigation block back.
// For convenience of developers, put the Administration menu block back.
$edit = array();
$edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $this->regions[1];
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to first sidebar region.');
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => 'Navigation'), t('Save block'));
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => 'Tools'), t('Save block'));
$this->assertText(t('The block configuration has been saved.'), 'Block title set.');
}
......
......@@ -23,14 +23,14 @@ function contact_help($path, $arg) {
$output .= '<dt>' . t('Site-wide contact forms') . '</dt>';
$output .= '<dd>' . t('The <a href="@contact">Contact page</a> provides a simple form for users with the <em>Use the site-wide contact form</em> permission to send comments, feedback, or other requests. You can create categories for directing the contact form messages to a set of defined recipients. Common categories for a business site, for example, might include "Website feedback" (messages are forwarded to website administrators) and "Product information" (messages are forwarded to members of the sales department). E-mail addresses defined within a category are not displayed publicly.', array('@contact' => url('contact'))) . '</p>';
$output .= '<dt>' . t('Navigation') . '</dt>';
$output .= '<dd>' . t("When the site-wide contact form is enabled, a link in the main <em>Navigation</em> menu is created, but the link is disabled by default. This menu link can be enabled on the <a href='@menu'>Menus administration page</a>.", array('@contact' => url('contact'), '@menu' => url('admin/structure/menu'))) . '</dd>';
$output .= '<dd>' . t('When the site-wide contact form is enabled, a link in the <em>Main navigation</em> menu is created, but the link is disabled by default. This menu link can be enabled on the <a href="@menu">Menus administration page</a>.', array('@menu' => url('admin/structure/menu'))) . '</dd>';
$output .= '<dt>' . t('Customization') . '</dt>';
$output .= '<dd>' . t('If you would like additional text to appear on the site-wide or personal contact page, use a block. You can create and edit blocks on the <a href="@blocks">Blocks administration page</a>.', array('@blocks' => url('admin/structure/block'))) . '</dd>';
$output .= '</dl>';
return $output;
case 'admin/structure/contact':
$output = '<p>' . t('Add one or more categories on this page to set up your site-wide <a href="@form">contact form</a>.', array('@form' => url('contact'))) . '</p>';
$output .= '<p>' . t('A <em>Contact</em> menu item (disabled by default) is added to the Navigation menu, which you can modify on the <a href="@menu-settings">Menus administration page</a>.', array('@menu-settings' => url('admin/structure/menu'))) . '</p>';
$output .= '<p>' . t('A <em>Contact</em> menu item (disabled by default) is added to the Tools menu, which you can modify on the <a href="@menu-settings">Menus administration page</a>.', array('@menu-settings' => url('admin/structure/menu'))) . '</p>';
$output .= '<p>' . t('If you would like additional text to appear on the site-wide contact page, use a block. You can create and edit blocks on the <a href="@blocks">Blocks administration page</a>.', array('@blocks' => url('admin/structure/block'))) . '</p>';
return $output;
}
......@@ -90,6 +90,7 @@ function contact_menu() {
'page callback' => 'drupal_get_form',
'page arguments' => array('contact_site_form'),
'access arguments' => array('access site-wide contact form'),
'menu_name' => 'main',
'type' => MENU_SUGGESTED_ITEM,
'file' => 'contact.pages.inc',
);
......
......@@ -128,8 +128,8 @@ function contextual_preprocess(&$variables, $hook) {
* menu_contextual_links(). For example:
* @code
* array('#contextual_links' => array(
* 'block' => array('admin/structure/block/manage', array('system', 'navigation')),
* 'menu' => array('admin/structure/menu/manage', array('navigation')),
* 'block' => array('admin/structure/block/manage', array('system', 'tools')),
* 'menu' => array('admin/structure/menu/manage', array('tools')),
* ))
* @endcode
*
......
......@@ -33,8 +33,8 @@ function forum_help($path, $arg) {
$output .= '<dd>' . t('Visit the <a href="@forums">Forums page</a> to set up containers and forums to hold your discussion topics.', array('@forums' => url('admin/structure/forum'))) . '</dd>';
$output .= '<dt>' . t('Starting a discussion') . '</dt>';
$output .= '<dd>' . t('The <a href="@create-topic">Forum topic</a> link on the <a href="@content-add">Add new content</a> page creates the first post of a new threaded discussion, or thread.', array('@create-topic' => url('node/add/forum'), '@content-add' => url('node/add'))) . '</dd>';
$output .= '<dt>' . t('Navigation') . '</dt>';
$output .= '<dd>' . t('Enabling the Forum module provides a default <em>Forums</em> menu item in the navigation menu that links to the <a href="@forums">Forums page</a>.', array('@forums' => url('forum'))) . '</dd>';
$output .= '<dt>' . t('Forum navigation') . '</dt>';
$output .= '<dd>' . t('Enabling the Forum module provides a default <em>Forums</em> menu item in the Tools menu that links to the <a href="@forums">Forums page</a>.', array('@forums' => url('forum'))) . '</dd>';
$output .= '<dt>' . t('Moving forum topics') . '</dt>';
$output .= '<dd>' . t('A forum topic (and all of its comments) may be moved between forums by selecting a different forum while editing a forum topic. When moving a forum topic between forums, the <em>Leave shadow copy</em> option creates a link in the original forum pointing to the new location.') . '</dd>';
$output .= '<dt>' . t('Locking and disabling comments') . '</dt>';
......
......@@ -250,11 +250,11 @@ private function doAdminTests($user) {
$this->drupalLogin($user);
// Retrieve forum menu id.
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'forum' AND menu_name = 'navigation' AND module = 'system' ORDER BY mlid ASC", 0, 1)->fetchField();
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'forum' AND menu_name = 'tools' AND module = 'system' ORDER BY mlid ASC", 0, 1)->fetchField();
// Add forum to navigation menu.
// Add forum to the Tools menu.
$edit = array();
$this->drupalPost('admin/structure/menu/manage/navigation', $edit, t('Save configuration'));
$this->drupalPost('admin/structure/menu/manage/tools', $edit, t('Save configuration'));
$this->assertResponse(200);
// Edit forum taxonomy.
......
main_links: main-menu
secondary_links: user-menu
main_links: main
secondary_links: account
......@@ -49,15 +49,14 @@ function setUp() {
* Test creating, editing, deleting menu links via node form widget.
*/
function testMenuNodeFormWidget() {
// Enable Navigation menu as available menu.
// Enable Tools menu as available menu.
$edit = array(
'menu_options[navigation]' => 1,
'menu_options[tools]' => 1,
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
// Change default parent item to Navigation menu, so we can assert more
// easily.
// Change default parent item to Tools menu, so we can assert more easily.
$edit = array(
'menu_parent' => 'navigation:0',
'menu_parent' => 'tools:0',
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
......@@ -106,24 +105,25 @@ function testMenuNodeFormWidget() {
$this->drupalGet('test-page');
$this->assertNoLink($node_title);
// Add a menu link to the Management menu.
// Add a menu link to the Administration menu.
$item = array(
'link_path' => 'node/' . $node->nid,
'link_title' => $this->randomName(16),
'menu_name' => 'management',
'menu_name' => 'admin',
);
menu_link_save($item);
// Assert that disabled Management menu is not shown on the node/$nid/edit page.
// Assert that disabled Administration menu is not shown on the
// node/$nid/edit page.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertText('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
// Assert that the link is still in the management menu after save.
// Assert that the link is still in the Administration menu after save.
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$link = menu_link_load($item['mlid']);
$this->assertTrue($link, 'Link in not allowed menu still exists after saving node');
// Move the menu link back to the Navigation menu.
$item['menu_name'] = 'navigation';
// Move the menu link back to the Tools menu.
$item['menu_name'] = 'tools';
menu_link_save($item);
// Create a second node.
$child_node = $this->drupalCreateNode(array('type' => 'article'));
......@@ -137,9 +137,9 @@ function testMenuNodeFormWidget() {
// Edit the first node.
$this->drupalGet('node/'. $node->nid .'/edit');
// Assert that it is not possible to set the parent of the first node to itself or the second node.
$this->assertNoOption('edit-menu-parent', 'navigation:'. $item['mlid']);
$this->assertNoOption('edit-menu-parent', 'navigation:'. $child_item['mlid']);
// Assert that unallowed Management menu is not available in options.
$this->assertNoOption('edit-menu-parent', 'management:0');
$this->assertNoOption('edit-menu-parent', 'tools:'. $item['mlid']);
$this->assertNoOption('edit-menu-parent', 'tools:'. $child_item['mlid']);
// Assert that unallowed Administration menu is not available in options.
$this->assertNoOption('edit-menu-parent', 'admin:0');
}
}
......@@ -28,7 +28,7 @@ class MenuTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Menu link creation/deletion',
'description' => 'Add a custom menu, add menu links to the custom menu and Navigation menu, check their data, and delete them using the menu module UI.',
'description' => 'Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the menu module UI.',
'group' => 'Menu'
);
}
......@@ -90,8 +90,7 @@ function testMenu() {
}
/**
* Test standard menu functionality using navigation menu.
*
* Tests standard menu functionality using the Tools menu.
*/
function doStandardMenuTests() {
$this->doMenuTests();
......@@ -99,8 +98,7 @@ function doStandardMenuTests() {
}
/**
* Test custom menu functionality using navigation menu.
*
* Tests custom menu functionality using the Tools menu.
*/
function doCustomMenuTests() {
$this->menu = $this->addCustomMenu();
......@@ -207,10 +205,9 @@ function deleteCustomMenu($menu) {
}
/**
* Test menu functionality using navigation menu.
*
* Tests menu functionality using the Tools menu.
*/
function doMenuTests($menu_name = 'navigation') {
function doMenuTests($menu_name = 'tools') {
// Add nodes to use as links for menu links.
$node1 = $this->drupalCreateNode(array('type' => 'article'));
$node2 = $this->drupalCreateNode(array('type' => 'article'));
......@@ -307,7 +304,7 @@ function testMenuQueryAndFragment() {
* @param string $weight Menu weight
* @return array Menu link created.
*/
function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'navigation', $expanded = TRUE, $weight = '0') {
function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'tools', $expanded = TRUE, $weight = '0') {
// View add menu link page.
$this->drupalGet("admin/structure/menu/manage/$menu_name/add");
$this->assertResponse(200);
......@@ -341,7 +338,7 @@ function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'navigation', $e
*
* @param string $menu_name Menu name.
*/
function addInvalidMenuLink($menu_name = 'navigation') {
function addInvalidMenuLink($menu_name = 'tools') {
foreach (array('-&-', 'admin/people/permissions', '#') as $link_path) {
$edit = array(
'link_path' => $link_path,
......@@ -571,11 +568,11 @@ private function verifyAccess($response = 200) {
$this->assertText(t('Menus'), 'Menu build overview node was displayed');
}
// View navigation menu customization node.
$this->drupalGet('admin/structure/menu/manage/navigation');
// View tools menu customization node.
$this->drupalGet('admin/structure/menu/manage/tools');
$this->assertResponse($response);
if ($response == 200) {
$this->assertText(t('Navigation'), 'Navigation menu node was displayed');
$this->assertText(t('Tools'), 'Tools menu node was displayed');
}
// View menu edit node.
......
......@@ -377,7 +377,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
$options = menu_parent_options(menu_get_menus(), $item);
$default = $item['menu_name'] . ':' . $item['plid'];
if (!isset($options[$default])) {
$default = 'navigation:0';
$default = 'tools:0';
}
$form['parent'] = array(
'#type' => 'select',
......
......@@ -10,7 +10,7 @@
*/
function menu_schema() {
$schema['menu_custom'] = array(
'description' => 'Holds definitions for top-level custom menus (for example, Main menu).',
'description' => 'Holds definitions for top-level custom menus (for example, Main navigation menu).',
'fields' => array(
'menu_name' => array(
'type' => 'varchar',
......@@ -47,10 +47,10 @@ function menu_install() {
$system_menus = menu_list_system_menus();
$t = get_t();
$descriptions = array(
'navigation' => $t('The <em>Navigation</em> menu contains links intended for site visitors. Links are added to the <em>Navigation</em> menu automatically by some modules.'),
'user-menu' => $t("The <em>User</em> menu contains links related to the user's account, as well as the 'Log out' link."),
'management' => $t('The <em>Management</em> menu contains links for administrative tasks.'),
'main-menu' => $t('The <em>Main</em> menu is used on many sites to show the major sections of the site, often in a top navigation bar.'),
'tools' => $t('Contains links for site visitors. Some modules add their links here.'),
'account' => $t('Links related to the user account.'),
'admin' => $t('Contains links to administrative tasks.'),
'main' => $t('Use this for linking to the main site sections.'),
);
foreach ($system_menus as $menu_name => $title) {
$menu = array(
......@@ -80,3 +80,24 @@ function menu_update_8000() {
'menu_secondary_links_source' => 'secondary_links',
));
}
/**
* Rename default menu names.
*/
function menu_update_8001() {
// Only the internal identifiers are updated; the labels and descriptions
// might have been customized and do not have to be renamed.
$map = array(
'navigation' => 'tools',
'management' => 'admin',
'user-menu' => 'account',
'main-menu' => 'main',
);
foreach ($map as $old => $new) {
db_update('menu_custom')
->condition('menu_name', $old)
->fields(array('menu_name' => $new))
->execute();
}
}
......@@ -376,7 +376,7 @@ function menu_parent_options($menus, $item, $type = '') {
}
else {
// If a node type is set, use all available menus for this type.
$type_menus = variable_get('menu_options_' . $type, array('main-menu' => 'main-menu'));
$type_menus = variable_get('menu_options_' . $type, array('main' => 'main'));
foreach ($type_menus as $menu) {
$available_menus[$menu] = $menu;
}
......@@ -569,12 +569,12 @@ function menu_node_predelete(Node $node) {
function menu_node_prepare(Node $node) {
if (empty($node->menu)) {
// Prepare the node for the edit form so that $node->menu always exists.
$menu_name = strtok(variable_get('menu_parent_' . $node->type, 'main-menu:0'), ':');
$menu_name = strtok(variable_get('menu_parent_' . $node->type, 'main:0'), ':');
$item = array();
if (isset($node->nid)) {
$mlid = FALSE;
// Give priority to the default menu
$type_menus = variable_get('menu_options_' . $node->type, array('main-menu' => 'main-menu'));
$type_menus = variable_get('menu_options_' . $node->type, array('main' => 'main'));
if (in_array($menu_name, $type_menus)) {
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name AND module = 'menu' ORDER BY mlid ASC", 0, 1, array(
':path' => 'node/' . $node->nid,
......@@ -690,7 +690,7 @@ function menu_form_node_form_alter(&$form, $form_state) {
'#description' => t('Shown when hovering over the menu link.'),
);
$default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $type, 'main-menu:0'));
$default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $type, 'main:0'));
// If the current parent menu item is not present in options, use the first
// available option as default value.
// @todo User should not be allowed to access menu link settings in such a
......@@ -762,7 +762,7 @@ function menu_form_node_type_form_alter(&$form, $form_state) {
$form['menu']['menu_options'] = array(
'#type' => 'checkboxes',
'#title' => t('Available menus'),
'#default_value' => variable_get('menu_options_' . $type->type, array('main-menu')),
'#default_value' => variable_get('menu_options_' . $type->type, array('main')),
'#options' => $menu_options,
'#description' => t('The menus available to place links in for this content type.'),
);
......@@ -774,7 +774,7 @@ function menu_form_node_type_form_alter(&$form, $form_state) {
$form['menu']['menu_parent'] = array(
'#type' => 'select',
'#title' => t('Default parent item'),
'#default_value' => variable_get('menu_parent_' . $type->type, 'main-menu:0'),
'#default_value' => variable_get('menu_parent_' . $type->type, 'main:0'),
'#options' => $options,
'#description' => t('Choose the menu item to be the default parent for a new link in the content authoring form.'),
'#attributes' => array('class' => array('menu-title-select')),
......
......@@ -1762,7 +1762,7 @@ function node_menu() {
$items['node'] = array(
'page callback' => 'node_page_default',
'access arguments' => array('access content'),
'menu_name' => 'navigation',
'menu_name' => 'tools',
'type' => MENU_CALLBACK,
);
$items['node/add'] = array(
......
......@@ -36,9 +36,9 @@ function setUp() {
$this->admin_user = $this->drupalCreateUser($perms);
$this->drupalLogin($this->admin_user);
// This test puts menu links in the Navigation menu and then tests for
// their presence on the page, so we need to ensure that the Navigation
// block will be displayed in all active themes.
// This test puts menu links in the Tools menu and then tests for their
// presence on the page, so we need to ensure that the Tools block will be
// displayed in all active themes.
db_update('block')
->fields(array(
// Use a region that is valid for all themes.
......@@ -46,7 +46,7 @@ function setUp() {
'status' => 1,
))
->condition('module', 'system')
->condition('delta', 'navigation')
->condition('delta', 'tools')
->execute();
}
......@@ -110,13 +110,13 @@ function testBreadCrumbs() {
$trail += array(
'admin/structure/menu' => t('Menus'),
);
$this->assertBreadcrumb('admin/structure/menu/manage/navigation', $trail);
$this->assertBreadcrumb('admin/structure/menu/manage/tools', $trail);
$trail += array(
'admin/structure/menu/manage/navigation' => t('Navigation'),
'admin/structure/menu/manage/tools' => t('Tools'),
);
$this->assertBreadcrumb("admin/structure/menu/item/6/edit", $trail);
$this->assertBreadcrumb('admin/structure/menu/manage/navigation/edit', $trail);
$this->assertBreadcrumb('admin/structure/menu/manage/navigation/add', $trail);
$this->assertBreadcrumb('admin/structure/menu/manage/tools/edit', $trail);
$this->assertBreadcrumb('admin/structure/menu/manage/tools/add', $trail);
// Verify Node administration breadcrumbs.
$trail = $admin + array(
......@@ -187,14 +187,14 @@ function testBreadCrumbs() {
$this->assertBreadcrumb('node', $trail);
// Verify node breadcrumbs (in menu).
// Do this separately for Main menu and Navigation menu, since only the
// Do this separately for Main menu and Tools menu, since only the
// latter is a preferred menu by default.
// @todo Also test all themes? Manually testing led to the suspicion that
// breadcrumbs may differ, possibly due to template.php overrides.
$menus = array('main-menu', 'navigation');
$menus = array('main', 'tools');
// Alter node type menu settings.
variable_set("menu_options_$type", $menus);
variable_set("menu_parent_$type", 'navigation:0');
variable_set("menu_parent_$type", 'tools:0');
foreach ($menus as $menu) {
// Create a parent node in the current menu.
......@@ -256,15 +256,15 @@ function testBreadCrumbs() {
$trail = array();
$this->assertBreadcrumb('node', $trail);
if ($menu == 'navigation') {
if ($menu == 'tools') {
$parent = $node2;
$child = $node3;
}
}
// Create a Navigation menu link for 'node', move the last parent node menu
// Create a Tools menu link for 'node', move the last parent node menu
// link below it, and verify a full breadcrumb for the last child node.
$menu = 'navigation';
$menu = 'tools';
$edit = array(
'link_title' => 'Root',
'link_path' => 'node',
......@@ -293,7 +293,7 @@ function testBreadCrumbs() {
$this->assertBreadcrumb("node/{$child->nid}", $trail, $child->title, $tree);
// Add a taxonomy term/tag to last node, and add a link for that term to the
// Navigation menu.
// Tools menu.
$tags = array(
'Drupal' => array(),
'Breadcrumbs' => array(),
......@@ -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-navigation',
':menu' => 'block-system-tools',
':href' => url($link['link_path']),
));
$this->assertTrue(count($elements) == 1, "Link to {$link['link_path']} appears only once.");
......@@ -420,7 +420,7 @@ function testBreadCrumbs() {
);
$this->assertBreadcrumb('user/' . $this->web_user->uid . '/edit', $trail, $this->web_user->name, $tree);
// Add a Navigation menu links for 'user' and $this->admin_user.
// Add a Tools menu links for 'user' and $this->admin_user.
// Although it may be faster to manage these links via low-level API
// functions, there's a lot that can go wrong in doing so.
$this->drupalLogin($this->admin_user);
......
......@@ -45,7 +45,7 @@ function setUp() {
db_merge('block')
->key(array(
'module' => 'system',
'delta' => 'navigation',
'delta' => 'tools',
'theme' => 'bartik',
))
->fields(array(
......@@ -265,7 +265,7 @@ function testMenuLinkMaintain() {
// Move second link to the main-menu, to test caching later on.
db_update('menu_links')
->fields(array('menu_name' => 'main-menu'))
->fields(array('menu_name' => 'main'))
->condition('link_title', 'Menu link #1-main')
->condition('customized', 0)
->condition('module', 'menu_test')
......
......@@ -33,9 +33,9 @@ function setUp() {
$this->admin_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages'));
$this->drupalLogin($this->admin_user);
// This test puts menu links in the Navigation menu and then tests for
// their presence on the page, so we need to ensure that the Navigation
// block will be displayed in all active themes.
// This test puts menu links in the Tools menu and then tests for their
// presence on the page, so we need to ensure that the Tools block will be
// displayed in all active themes.
db_update('block')
->fields(array(
// Use a region that is valid for all themes.
......@@ -43,11 +43,11 @@ function setUp() {
'status' => 1,
))
->condition('module', 'system')
->condition('delta', 'navigation')
->condition('delta', 'tools')
->execute();
// This test puts menu links in the Management menu and then tests for
// their presence on the page, so we need to ensure that the Management
// This test puts menu links in the Administration menu and then tests for
// their presence on the page, so we need to ensure that the Administration
// block will be displayed in all active themes.
db_update('block')
->fields(array(
......@@ -56,7 +56,7 @@ function setUp() {
'status' => 1,
))
->condition('module', 'system')
->condition('delta', 'management')
->condition('delta', 'admin')
->execute();
}
......@@ -75,7 +75,7 @@ function testMenuTreeSetPath() {
// the menu_test_menu_trail_callback() callback (used by all paths in these
// tests) issues an overriding call to menu_trail_set_path().
$test_menu_path = array(
'menu_name' => 'management',
'menu_name' => 'admin',
'path' => 'admin/config/system/site-information',
);
......@@ -87,12 +87,12 @@ function testMenuTreeSetPath() {
'menu-test/menu-trail' => t('Menu trail - Case 1'),
);
// Test the tree generation for the Navigation menu.
// Test the tree generation for the Tools menu.
variable_del('menu_test_menu_tree_set_path');
$this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree);
// Override the active trail for the Management tree; it should not affect
// the Navigation tree.
// Override the active trail for the Administration tree; it should not
// affect the Tools tree.
variable_set('menu_test_menu_tree_set_path', $test_menu_path);
$this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree);
......@@ -113,12 +113,12 @@ function testMenuTreeSetPath() {
'admin/config/system/site-information' => t('Site information'),
);
// Test the tree generation for the Management menu.
// Test the tree generation for the Administration menu.
variable_del('menu_test_menu_tree_set_path');
$this->assertBreadcrumb('admin/config/development/menu-trail', $breadcrumb, t('Menu trail - Case 2'), $tree);
// Override the active trail for the Management tree; it should affect the
// breadcrumbs and Management tree.
// Override the active trail for the Administration tree; it should affect
// the breadcrumbs and Administration tree.
variable_set('menu_test_menu_tree_set_path', $test_menu_path);
$this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree);
}
......
......@@ -615,7 +615,7 @@ function hook_route_info() {
*
* This hook enables modules to register paths in order to define how URL
* requests are handled. Paths may be registered for URL handling only, or they
* can register a link to be placed in a menu (usually the Navigation menu). A
* can register a link to be placed in a menu (usually the Tools menu). A
* path and its associated information is commonly called a "menu router item".
* This hook is rarely called (for example, when modules are enabled), and
* its results are cached in the database.
......@@ -867,7 +867,7 @@ function hook_route_info() {
* the menu; higher-weighted items sink. Defaults to 0. Menu items with the
* same weight are ordered alphabetically.
* - "menu_name": Optional. Set this to a custom menu if you don't want your
* item to be placed in Navigation.
* item to be placed in the default Tools menu.
* - "context": (optional) Defines the context a tab may appear in. By
* default, all tabs are only displayed as local tasks when being rendered
* in a page context. All tabs that should be accessible as contextual links
......
......@@ -1033,7 +1033,7 @@ function system_schema() {
'description' => 'Contains the individual links within a menu.',
'fields' => array(
'menu_name' => array(
'description' => "The menu name. All links with the same menu name (such as 'navigation') are part of the same menu.",
'description' => "The menu name. All links with the same menu name (such as 'tools') are part of the same menu.",
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
......@@ -2187,6 +2187,24 @@ function system_update_8030() {
));
}
/**
* Rename default menu names.
*/
function system_update_8031() {
$map = array(
'navigation' => 'tools',
'management' => 'admin',
'user-menu' => 'account',
'main-menu' => 'main',
);
foreach ($map as $old => $new) {
db_update('menu_links')
->condition('menu_name', $old)
->fields(array('menu_name' => $new))
->execute();
}
}
/**
* @} End of "defgroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
......
......@@ -608,7 +608,7 @@ function system_menu() {
'access arguments' => array('access administration pages'),
'page callback' => 'system_admin_menu_block_page',
'weight' => 9,
'menu_name' => 'management',
'menu_name' => 'admin',
'file' => 'system.admin.inc',
);
$items['admin/compact'] = array(
......