diff --git a/includes/menu.inc b/includes/menu.inc index 1a54f159483f1e93359f53a25f14f57d278194bd..0806a31cfceaabf59c18563d5c91dd4f9508b024 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2379,13 +2379,15 @@ function menu_link_get_preferred($path = NULL) { $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); $query->fields('ml'); // Weight must be taken from {menu_links}, not {menu_router}. - $query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight'))); + $query->addField('ml', 'weight', 'link_weight'); + $query->fields('m'); $query->condition('ml.menu_name', $menu_names, 'IN'); $query->condition('ml.link_path', $path_candidates, 'IN'); // Sort candidates by link path and menu name. $candidates = array(); foreach ($query->execute() as $candidate) { + $candidate['weight'] = $candidate['link_weight']; $candidates[$candidate['link_path']][$candidate['menu_name']] = $candidate; } @@ -2505,9 +2507,11 @@ function menu_link_load($mlid) { $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); $query->fields('ml'); // Weight should be taken from {menu_links}, not {menu_router}. - $query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight'))); + $query->addField('ml', 'weight', 'link_weight'); + $query->fields('m'); $query->condition('ml.mlid', $mlid); if ($item = $query->execute()->fetchAssoc()) { + $item['weight'] = $item['link_weight']; _menu_link_translate($item); return $item; }