You are here

function _nodehierarchy_get_parent_menu in Node Hierarchy 5

Same name and namespace in other branches
  1. 6 nodehierarchy.module \_nodehierarchy_get_parent_menu()

Find the menu ID for parent of the given node.

1 call to _nodehierarchy_get_parent_menu()
_nodehierarchy_set_menu_order in ./nodehierarchy.module
Reorder the child menus of the given parent.

File

./nodehierarchy.module, line 1023
A module to make nodes hierarchical.

Code

function _nodehierarchy_get_parent_menu($parent, $nid) {

  // If the item has a parent node, get the parent's menu item (if any).
  if ($parent) {
    return _nodehierarchy_get_menu($nid);
  }
  else {
    $item = db_fetch_array(db_query("SELECT pid FROM {menu} WHERE path = 'node/%d'", $nid));
    return isset($item['pid']) ? $item['pid'] : 0;
  }
}