function menu_node_record_save in Menu Node API 7
Save records to the {menu_node} table.
After saving, we fire the appropriate menu_node hook, either 'insert' or 'update'.
Parameters
$node: The node being saved.
$link: The menu link being saved.
2 calls to menu_node_record_save()
- menu_node_menu_link_insert in ./
menu_node.module  - Implements hook_menu_link_insert().
 - menu_node_menu_link_update in ./
menu_node.module  - Implements hook_menu_link_update().
 
File
- ./
menu_node.module, line 297  - Menu Node API Manages relationships between the {node} and {menu_links} table.
 
Code
function menu_node_record_save($node, $link, $hook = 'update') {
  // Our internal API uses $link as an object, not an array.
  $link = (object) $link;
  $new = menu_node_exists($link->mlid);
  $record = array(
    'nid' => $node->nid,
    'mlid' => $link->mlid,
  );
  // Save if the record does not exist, otherwise update the existing link
  if (empty($new)) {
    drupal_write_record('menu_node', $record);
    $hook = 'insert';
  }
  else {
    drupal_write_record('menu_node', $record, 'mlid');
  }
  _menu_node_invoke($node, $link, $hook);
}