node_form_submit

Versions
4.7
node_form_submit($form_id, $edit)
5
node_form_submit($form_id, $form_values)
6 – 7
node_form_submit($form, &$form_state)

Code

modules/node/node.module, line 2359

<?php
function node_form_submit($form_id, $form_values) {
  global $user;

  // Fix up the node when required:
  $node = node_submit($form_values);

  // Prepare the node's body:
  if ($node->nid) {
    node_save($node);
    watchdog('content', t('@type: updated %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
    drupal_set_message(t('The %post has been updated.', array('%post' => node_get_types('name', $node))));
  }
  else {
    node_save($node);
    watchdog('content', t('@type: added %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
    drupal_set_message(t('Your %post has been created.', array('%post' => node_get_types('name', $node))));
  }
  if ($node->nid) {
    if (node_access('view', $node)) {
      return 'node/'. $node->nid;
    }
    else {
      return '';
    }
  }
  // it is very unlikely we get here
  return FALSE;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.