You are here

function scanner_form_submit in Search and Replace Scanner 6

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

Handles submission of the search and replace form.

_state

Parameters

$form:

Return value

the new path that will be goto'ed.

File

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

Code

function scanner_form_submit($form, &$form_state) {

  //save form input:
  $_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_published'] = $form_state['values']['published'];
  $_SESSION['scanner_regex'] = $form_state['values']['regex'];
  $_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'] == 'Replace') {
    $_SESSION['scanner_status'] = SCANNER_STATUS_GO_CONFIRM;
  }
  else {
    $_SESSION['scanner_status'] = SCANNER_STATUS_GO_SEARCH;
  }
  $form_state['redirect'] = 'admin/content/scanner';
}