function menu_node_access_get_links in Panels Extras 7
Same name and namespace in other branches
- 6 menu_node_access/menu_node_access.module \menu_node_access_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 link 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.
1 call to menu_node_access_get_links()
- menu_node_access_node_load in menu_node_access/
menu_node_access.module - Implements hook_node_load().
File
- menu_node_access/
menu_node_access.module, line 43 - menu_node_access.module Add a node selection rule "Node : Belongs to a Menu"
Code
function menu_node_access_get_links($nid, $router = FALSE) {
$result = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(
':link_path' => 'node/' . $nid,
));
$items = array();
foreach ($result as $data) {
if ($router) {
$data->menu_router = menu_get_item('node/' . $nid);
}
$items[$data->mlid] = $data;
}
return $items;
}