function menu_node_get_parent in Menu Node API 7
Same name and namespace in other branches
- 6 menu_node.module \menu_node_get_parent()
Return the parent link of a menu element.
Parameters
$item: The menu item.
$return: Indicates the value to return, options are: -- 'title' returns the name of the parent menu item. -- 'item' returns the entire parent, as loaded by menu_get_item().
Return value
A string, representing the parent name or a menu object.
1 call to menu_node_get_parent()
- _menu_node_tree in ./
menu_node.module - A private recursive sort function.
File
- ./
menu_node.module, line 278 - Menu Node API Manages relationships between the {node} and {menu_links} table.
Code
function menu_node_get_parent($item, $return = 'title') {
if ($return == 'title') {
return db_query("SELECT link_title FROM {menu_links} WHERE mlid = :mlid", array(
':mlid' => $item['p1'],
))
->fetchField();
}
$path = db_query("SELECT link_path FROM {menu_links} WHERE mlid = :mlid", array(
':mlid' => $item['p1'],
))
->fetchField();
return menu_get_item($path);
}