function _nodehierarchy_get_node_mlid in Node Hierarchy 6.2
Same name and namespace in other branches
- 6.3 nodehierarchy.module \_nodehierarchy_get_node_mlid()
- 7.2 nodehierarchy.module \_nodehierarchy_get_node_mlid()
Get the primary menu link id for the given node. Optionally create one if needed.
5 calls to _nodehierarchy_get_node_mlid()
- nodehierarchy_form_menu_edit_item_submit in ./nodehierarchy.module 
- Submit the menu_edit_item form.
- nodehierarchy_update_6200 in ./nodehierarchy.install 
- Update from the 5.x or 6.x-1.x branches.
- _nodehierarchy_get_children_count in ./nodehierarchy.module 
- Count the children of the given node.
- _nodehierarchy_get_parent_selector_value in ./nodehierarchy.module 
- Get the parent selector key from a menu_link array. Returns either nid:mlid or nid
- _nodehierarchy_save_node in ./nodehierarchy.module 
- Do the actual insertion or update. No permissions checking is done here.
File
- ./nodehierarchy.module, line 1144 
- A module to make nodes hierarchical.
Code
function _nodehierarchy_get_node_mlid($nid, $create = FALSE) {
  $out = NULL;
  if ($nid) {
    $out = db_result(db_query("SELECT mlid FROM {menu_links} WHERE module = 'nodehierarchy' AND link_path = 'node/%d' ORDER BY mlid LIMIT 1", $nid));
    // Create a new menu item if needed.
    if ($create && !$out) {
      $menu_link = _nodehierarchy_create_node_menu_link($nid);
      $out = $menu_link['mlid'];
    }
  }
  return $out;
}