You are here

function menu_node_save in Menu Node API 6

Save records to the {menu_node} table.

After saving, we fire the appropriate menu_node hook, either 'insert' or 'update'.

Parameters

$nid: The node id.

$mlid: The menu link id.

2 calls to menu_node_save()
menu_node_edit_form_submit in ./menu_node.module
Custom form handler to react to menu changes.
menu_node_nodeapi in ./menu_node.module
Implements hook_nodeapi().

File

./menu_node.module, line 281
Menu Node API Manages relationships between the {node} and {menu_links} table.

Code

function menu_node_save($nid, $mlid, $hook = 'update') {
  $new = menu_node_exists($mlid);
  $record = array(
    'nid' => $nid,
    'mlid' => $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($nid, $mlid, $hook);
}