menu_node_get_node

Versions
menu_node
menu_node_get_node($mlid, $load = TRUE)

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 functions call 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.

Code

./menu_node.module, line 48

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

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List