The parent link detection code in menu.inc is broken, due to bad conversion to DB:TNG. In particular, this breaks breadcrumbs when you have a "hole" in the path hierarchy (ie. you have "/test" and "/test/toto/titi", but no "/test/toto").
$query = db_select('menu_links');
// Only links derived from router items should have module == 'system', and
// we want to find the parent even if it's in a different menu.
if ($item['module'] == 'system') {
$query->condition('module', 'system');
}
else {
// If not derived from a router item, we respect the specified menu name.
$query->condition('menu_name', $item['menu_name']);
}
// Find the parent - it must be unique.
$parent_path = $item['link_path'];
do {
$parent = FALSE;
$parent_path = substr($parent_path, 0, strrpos($parent_path, '/'));
$query->condition('link_path', $parent_path);
$query_cnt = $query;
// Only valid if we get a unique result.
if ($query_cnt->countQuery()->execute()->fetchField() == 1) {
$parent = $query->fields('menu_links')->execute()->fetchAssoc();
}
} while ($parent === FALSE && $parent_path);
Comments
Comment #1
damien tournoud commentedPatch + Test.
Comment #3
damien tournoud commentedThe test bot is right...
Comment #4
dries commentedGood catch. Thanks Damien. Committed.