You are here

function menu_node_get_node in Menu Node API 6

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

Get the relevant node object for a menu item.

Parameters

$mlid: The menu link id.

$load: Boolean value that indicates whether to return the node id or a full $node.

Return value

A node id, a complete node object or FALSE on failure.

3 calls to menu_node_get_node()
menu_node_delete_form_submit in ./menu_node.module
Custom form handler to react to menu item changes.
menu_node_delete_menu_form_submit in ./menu_node.module
Custom form handler to react to custom menu changes.
_menu_node_invoke in ./menu_node.module
Wrapper function for module hooks.

File

./menu_node.module, line 55
Menu Node API Manages relationships between the {node} and {menu_links} table.

Code

function menu_node_get_node($mlid, $load = TRUE) {
  $nid = db_result(db_query("SELECT n.nid FROM {node} n INNER JOIN {menu_node} mn ON n.nid = mn.nid WHERE mn.mlid = %d", $mlid));
  if (empty($nid)) {
    return FALSE;
  }
  if ($load) {
    return node_load($nid);
  }
  return $nid;
}