You are here

function _nodehierarchy_get_menu in Node Hierarchy 5

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

Find the menu ID for the given node, optionally with the given parent menu ID.

5 calls to _nodehierarchy_get_menu()
nodehierarchy_nodehierarchyapi in ./nodehierarchy.module
Implementation of hook_nodehierarchyapi(). Responds to own api calls.
_nodehierarchy_create_menu in ./nodehierarchy.module
Create a menu item if the user selects one.
_nodehierarchy_get_parent_menu in ./nodehierarchy.module
Find the menu ID for parent of the given node.
_nodehierarchy_set_menu_order in ./nodehierarchy.module
Reorder the child menus of the given parent.
_nodehierarchy_swap_menu_order in ./nodehierarchy.module
Reorder the child menus of the given parent.

File

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

Code

function _nodehierarchy_get_menu($nid, $pid = NULL) {
  if ($pid) {
    $item = db_fetch_array(db_query("SELECT mid FROM {menu} WHERE path = 'node/%d' AND pid = '%d'", $nid, $pid));
  }
  else {
    $item = db_fetch_array(db_query("SELECT mid FROM {menu} WHERE path = 'node/%d'", $nid));
  }
  return isset($item['mid']) ? $item['mid'] : 0;
}