updated core to 7.73
This commit is contained in:
@@ -281,6 +281,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
|
||||
$form['link_title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Menu link title'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $item['link_title'],
|
||||
'#description' => t('The text to be used for this link in the menu.'),
|
||||
'#required' => TRUE,
|
||||
@@ -305,7 +306,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
|
||||
'#title' => t('Path'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $path,
|
||||
'#description' => t('The path for this menu link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')),
|
||||
'#description' => t('The path for this menu link. This can be an internal path such as %add-node or an external URL such as %example. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%example' => 'http://example.com')),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
$form['actions']['delete'] = array(
|
||||
@@ -512,8 +513,7 @@ function menu_delete_menu_page($menu) {
|
||||
// System-defined menus may not be deleted.
|
||||
$system_menus = menu_list_system_menus();
|
||||
if (isset($system_menus[$menu['menu_name']])) {
|
||||
drupal_access_denied();
|
||||
return;
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
return drupal_get_form('menu_delete_menu_confirm', $menu);
|
||||
}
|
||||
@@ -622,8 +622,7 @@ function menu_item_delete_page($item) {
|
||||
// Links defined via hook_menu may not be deleted. Updated items are an
|
||||
// exception, as they can be broken.
|
||||
if ($item['module'] == 'system' && !$item['updated']) {
|
||||
drupal_access_denied();
|
||||
return;
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
return drupal_get_form('menu_item_delete_form', $item);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ core = 7.x
|
||||
files[] = menu.test
|
||||
configure = admin/structure/menu
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by Drupal.org packaging script on 2020-09-16
|
||||
version = "7.73"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
|
||||
datestamp = "1600272641"
|
||||
|
||||
@@ -69,7 +69,7 @@ function menu_menu() {
|
||||
'title' => 'Parent menu items',
|
||||
'page callback' => 'menu_parent_options_js',
|
||||
'type' => MENU_CALLBACK,
|
||||
'access arguments' => array(TRUE),
|
||||
'access arguments' => array('administer menu'),
|
||||
);
|
||||
$items['admin/structure/menu/list'] = array(
|
||||
'title' => 'List menus',
|
||||
@@ -674,6 +674,7 @@ function menu_form_node_form_alter(&$form, $form_state) {
|
||||
$form['menu']['link']['link_title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Menu link title'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $link['link_title'],
|
||||
);
|
||||
|
||||
|
||||
+60
-23
@@ -70,8 +70,19 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item['options']['attributes']['title'] = $description;
|
||||
menu_link_save($item);
|
||||
$saved_item = menu_link_load($item['mlid']);
|
||||
$this->assertEqual($description, $saved_item['options']['attributes']['title'], t('Saving an existing link updates the description (title attribute)'));
|
||||
$this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
|
||||
$this->resetMenuLink($item, $old_title);
|
||||
|
||||
// Test that the page title is correct when a local task appears in a
|
||||
// top-level menu item. See https://www.drupal.org/node/1973262.
|
||||
$item = $this->addMenuLink(0, 'user/register', 'user-menu');
|
||||
$this->drupalGet('user/password');
|
||||
$this->assertNoTitle('Home | Drupal');
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('user/register');
|
||||
$this->assertTitle($item['link_title'] . ' | Drupal');
|
||||
$this->drupalGet('user');
|
||||
$this->assertNoTitle('Home | Drupal');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,14 +122,14 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Assert the new menu.
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
|
||||
$this->assertRaw($title, t('Custom menu was added.'));
|
||||
$this->assertRaw($title, 'Custom menu was added.');
|
||||
|
||||
// Edit the menu.
|
||||
$new_title = $this->randomName(16);
|
||||
$menu['title'] = $new_title;
|
||||
menu_save($menu);
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
|
||||
$this->assertRaw($new_title, t('Custom menu was edited.'));
|
||||
$this->assertRaw($new_title, 'Custom menu was edited.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +178,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$edit['blocks[menu_' . $menu_name . '][region]'] = 'sidebar_first';
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('The block settings have been updated.'), t('Custom menu block was enabled'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Custom menu block was enabled');
|
||||
|
||||
return menu_load($menu_name);
|
||||
}
|
||||
@@ -184,11 +195,11 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Delete custom menu.
|
||||
$this->drupalPost("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), t('Custom menu was deleted'));
|
||||
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), 'Custom menu was deleted');
|
||||
$this->assertFalse(menu_load($menu_name), 'Custom menu was deleted');
|
||||
// Test if all menu links associated to the menu were removed from database.
|
||||
$result = db_query("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu_name))->fetchField();
|
||||
$this->assertFalse($result, t('All menu links associated to the custom menu were deleted.'));
|
||||
$this->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,13 +277,13 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item = $this->addMenuLink(0, $path);
|
||||
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertFieldByName('link_path', $path, t('Path is found with both query and fragment.'));
|
||||
$this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
|
||||
|
||||
// Now change the path to something without query and fragment.
|
||||
$path = 'node';
|
||||
$this->drupalPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array('link_path' => $path), t('Save'));
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertFieldByName('link_path', $path, t('Path no longer has query or fragment.'));
|
||||
$this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,7 +361,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $parent_node->title;
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Parent menu link link target was correct');
|
||||
}
|
||||
|
||||
// Verify menu link.
|
||||
@@ -360,7 +371,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $item_node->title;
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Menu link link target was correct');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,7 +423,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Reset menu link.
|
||||
$this->drupalPost("admin/structure/menu/item/$mlid/reset", array(), t('Reset'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'), t('Menu link was reset'));
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');
|
||||
|
||||
// Verify menu link.
|
||||
$this->drupalGet('');
|
||||
@@ -432,7 +443,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Delete menu link.
|
||||
$this->drupalPost("admin/structure/menu/item/$mlid/delete", array(), t('Confirm'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), t('Menu link was deleted'));
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), 'Menu link was deleted');
|
||||
|
||||
// Verify deletion.
|
||||
$this->drupalGet('');
|
||||
@@ -509,10 +520,27 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item['link_path'] .= '#' . $options['fragment'];
|
||||
}
|
||||
foreach ($expected_item as $key => $value) {
|
||||
$this->assertEqual($item[$key], $value, t('Parameter %key had expected value.', array('%key' => $key)));
|
||||
$this->assertEqual($item[$key], $value, format_string('Parameter %key had expected value.', array('%key' => $key)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test administrative users other than user 1 can access the menu parents AJAX callback.
|
||||
*/
|
||||
public function testMenuParentsJsAccess() {
|
||||
$admin = $this->drupalCreateUser(array('administer menu'));
|
||||
$this->drupalLogin($admin);
|
||||
// Just check access to the callback overall, the POST data is irrelevant.
|
||||
$this->drupalGetAJAX('admin/structure/menu/parents');
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Do standard user tests.
|
||||
// Login the user.
|
||||
$this->drupalLogin($this->std_user);
|
||||
$this->drupalGetAJAX('admin/structure/menu/parents');
|
||||
$this->assertResponse(403);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get standard menu link.
|
||||
*/
|
||||
@@ -537,21 +565,21 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/help/menu');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menu'), t('Menu help was displayed'));
|
||||
$this->assertText(t('Menu'), 'Menu help was displayed');
|
||||
}
|
||||
|
||||
// View menu build overview node.
|
||||
$this->drupalGet('admin/structure/menu');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Menu build overview node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Menu build overview node was displayed');
|
||||
}
|
||||
|
||||
// View navigation menu customization node.
|
||||
$this->drupalGet('admin/structure/menu/manage/navigation');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Navigation'), t('Navigation menu node was displayed'));
|
||||
$this->assertText(t('Navigation'), 'Navigation menu node was displayed');
|
||||
}
|
||||
|
||||
// View menu edit node.
|
||||
@@ -559,21 +587,21 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Edit menu item'), t('Menu edit node was displayed'));
|
||||
$this->assertText(t('Edit menu item'), 'Menu edit node was displayed');
|
||||
}
|
||||
|
||||
// View menu settings node.
|
||||
$this->drupalGet('admin/structure/menu/settings');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Menu settings node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Menu settings node was displayed');
|
||||
}
|
||||
|
||||
// View add menu node.
|
||||
$this->drupalGet('admin/structure/menu/add');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Add menu node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Add menu node was displayed');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -620,7 +648,12 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
|
||||
|
||||
// Create a node.
|
||||
// Verify that the menu link title on the node add form has the correct
|
||||
// maxlength.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertPattern('/<input .* id="edit-menu-link-title" .* maxlength="255" .* \/>/', 'Menu link title field has correct maxlength in node add form.');
|
||||
|
||||
// Create a node with menu link disabled.
|
||||
$node_title = $this->randomName();
|
||||
$language = LANGUAGE_NONE;
|
||||
$edit = array(
|
||||
@@ -654,7 +687,11 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
$this->assertLink($node_title);
|
||||
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertOptionSelected('edit-menu-weight', 17, t('Menu weight correct in edit form'));
|
||||
$this->assertOptionSelected('edit-menu-weight', 17, 'Menu weight correct in edit form');
|
||||
|
||||
// Verify that the menu link title on the node edit form has the correct
|
||||
// maxlength.
|
||||
$this->assertPattern('/<input .* id="edit-menu-link-title" .* maxlength="255" .* \/>/', 'Menu link title field has correct maxlength in node edit form.');
|
||||
|
||||
// Edit the node and remove the menu link.
|
||||
$edit = array(
|
||||
@@ -675,11 +712,11 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Assert that disabled Management menu is not shown on the node/$nid/edit page.
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertText('Provide a menu link', t('Link in not allowed menu not shown in node edit form'));
|
||||
$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.
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
$link = menu_link_load($item['mlid']);
|
||||
$this->assertTrue($link, t('Link in not allowed menu still exists after saving node'));
|
||||
$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';
|
||||
|
||||
Reference in New Issue
Block a user