Skip to content
Snippets Groups Projects
Commit 833ab255 authored by Angie Byron's avatar Angie Byron
Browse files

#605926 by jim0203, sun, jhodgdon, dman, eileenmcnaughton, Gábor Hojtsy: Fixed...

#605926 by jim0203, sun, jhodgdon, dman, eileenmcnaughton, Gábor Hojtsy: Fixed Menu link weight changes when editing a node. (with tests)
parent fd7a3244
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -2194,7 +2194,8 @@ function menu_link_load($mlid) {
$query = db_select('menu_links', 'ml');
$query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
$query->fields('ml');
$query->fields('m');
// Weight should be taken from {menu_links}, not {menu_router}.
$query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight')));
$query->condition('ml.mlid', $mlid);
if ($item = $query->execute()->fetchAssoc()) {
_menu_link_translate($item);
......
......@@ -606,12 +606,16 @@ class MenuNodeTestCase extends DrupalWebTestCase {
$edit = array(
'menu[enabled]' => 1,
'menu[link_title]' => $node_title,
'menu[weight]' => 17,
);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
// Assert that the link exists.
$this->drupalGet('');
$this->assertLink($node_title);
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertOptionSelected('edit-menu-weight', 17, t('Menu weight correct in edit form'));
// Edit the node and remove the menu link.
$edit = array(
'menu[enabled]' => FALSE,
......@@ -622,4 +626,3 @@ class MenuNodeTestCase extends DrupalWebTestCase {
$this->assertNoLink($node_title);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment