You are here

function menu_node_get_parent in Menu Node API 6

Same name and namespace in other branches
  1. 7 menu_node.module \menu_node_get_parent()

Return the parent item 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 218
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_result(db_query("SELECT link_title FROM {menu_links} WHERE mlid = %d", $item['p1']));
  }
  $path = db_result(db_query("SELECT link_path FROM {menu_links} WHERE mlid = %d", $item['p1']));
  return menu_get_item($path);
}