You are here

function addanother_node_form_submit in Add Another 7.2

Same name and namespace in other branches
  1. 8 addanother.module \addanother_node_form_submit()

Form submit handler for node_form().

Submit handler for the 'Save and add another' button. This allows a redirect to be set if this was the button pressed.

1 string reference to 'addanother_node_form_submit'
addanother_form_alter in ./addanother.module
Implements hook_form_alter().

File

./addanother.module, line 205
The main file for the addanother module.

Code

function addanother_node_form_submit($form, &$form_state) {
  if ($node = _addanother_get_node_from_form_state($form_state)) {
    _addanother_quelch_message($node);
    theme('addanother_button_message', array(
      'nid' => $node->nid,
    ));

    // If there are query parameters, keep them for the next cycle.
    $parameters = drupal_get_query_parameters();
    $_GET['destination'] = url(_addanother_node_add_path($node), array(
      'query' => $parameters,
    ));
  }
}