menu_node_get_parent

Versions
menu_node
menu_node_get_parent($item, $return = 'title')

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.

Code

./menu_node.module, line 211

<?php
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);
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List