function menu_node_get_nodes_by_menu in Menu Node API 6
Same name and namespace in other branches
- 7 menu_node.module \menu_node_get_nodes_by_menu()
Get all nodes assigned to a specific menu.
Parameters
$menu_name: The machine name of the menu, e.g. 'navigation'.
$load: Boolean flag that indicates whether to load the node object or not. NOTE: This can be resource intensive!
Return value
A simple array of node ids.
File
- ./
menu_node.module, line 116 - Menu Node API Manages relationships between the {node} and {menu_links} table.
Code
function menu_node_get_nodes_by_menu($menu_name, $load = FALSE) {
$links = array();
$result = db_query("SELECT mn.nid FROM {menu_node} mn INNER JOIN {menu_links} ml ON mn.mlid = ml.mlid WHERE ml.menu_name = '%s'", $menu_name);
while ($data = db_fetch_object($result)) {
if ($load) {
$nodes[$data->nid] = node_load($data->nid);
}
else {
$nodes[] = $data->nid;
}
}
return $nodes;
}