You are here

function scanner_form_submit in Search and Replace Scanner 7

Same name and namespace in other branches
  1. 5.2 scanner.module \scanner_form_submit()
  2. 6 scanner.module \scanner_form_submit()

Form submission handler for scanner_form().

See also

scanner_form()

scanner_form_validate()

File

./scanner.module, line 402
Search and Replace Scanner - works on all nodes text content.

Code

function scanner_form_submit($form, &$form_state) {

  // Save form input into session.
  $_SESSION['scanner_search'] = $form_state['values']['search'];
  $_SESSION['scanner_preceded'] = $form_state['values']['preceded'];

  // $_SESSION['scanner_notpreceded'] = $form_state['values']['notpreceded'];
  $_SESSION['scanner_followed'] = $form_state['values']['followed'];

  // $_SESSION['scanner_notfollowed'] = $form_state['values']['notfollowed'];
  $_SESSION['scanner_mode'] = $form_state['values']['mode'];
  $_SESSION['scanner_wholeword'] = $form_state['values']['wholeword'];
  $_SESSION['scanner_regex'] = $form_state['values']['regex'];
  $_SESSION['scanner_published'] = $form_state['values']['published'];
  $_SESSION['scanner_pathauto'] = $form_state['values']['pathauto'];
  if (isset($form_state['values']['terms'])) {
    $_SESSION['scanner_terms'] = $form_state['values']['terms'];
  }
  $_SESSION['scanner_replace'] = $form_state['values']['replace'];

  // @todo The 'op' element in the form values is deprecated.
  // Each button can have #validate and #submit functions associated with it.
  // Thus, there should be one button that submits the form and which invokes
  // the normal form_id_validate and form_id_submit handlers. Any additional
  // buttons which need to invoke different validate or submit functionality
  // should have button-specific functions.
  if ($form_state['values']['op'] == t('Replace')) {
    $_SESSION['scanner_status'] = SCANNER_STATUS_GO_CONFIRM;
  }
  else {
    $_SESSION['scanner_status'] = SCANNER_STATUS_GO_SEARCH;
  }
  $form_state['redirect'] = 'admin/content/scanner';
}