function menu_node_get_links in Menu Node API 6
Same name and namespace in other branches
- 7 menu_node.module \menu_node_get_links()
Get the relevant menu links for a node.
Parameters
$nid: The node id.
$router: Boolean flag indicating whether to attach the menu router item to the $item object. If set to TRUE, the router will be set as $item->menu_router.
Return value
An array of complete menu_link objects or an empy array on failure.
2 calls to menu_node_get_links()
- menu_node_nodeapi in ./
menu_node.module - Implements hook_nodeapi().
- _menu_node_invoke in ./
menu_node.module - Wrapper function for module hooks.
File
- ./
menu_node.module, line 76 - Menu Node API Manages relationships between the {node} and {menu_links} table.
Code
function menu_node_get_links($nid, $router = FALSE) {
$result = db_query("SELECT * FROM {menu_links} WHERE link_path = '%s'", 'node/' . $nid);
$items = array();
while ($data = db_fetch_object($result)) {
if ($router) {
$data->menu_router = menu_get_item('node/' . $nid);
}
$items[$data->mlid] = $data;
}
return $items;
}