You are here

function ajax_submitter in Ajax 6

Submission handler callback

Parameters

$form Assoc:

$form_state Assoc:

Return value

Bool

2 string references to 'ajax_submitter'
ajax_submitter_find in ./ajax.module
Finds the submitter
ajax_submitter_set in ./ajax.module
Sets the submitter

File

./ajax.module, line 334

Code

function ajax_submitter(&$form, &$form_state) {
  $messages = drupal_get_messages(NULL, TRUE);
  $data = array(
    'form_id' => $form_state['values']['form_id'],
    'options' => $form['#ajax'],
  );

  // Node Preview
  if (array_key_exists('node_preview', $form_state) && !empty($form_state['node_preview'])) {
    $data['preview'] = $form_state['node_preview'];
  }

  // form_state:redirect
  if (array_key_exists('redirect', $form_state) && !empty($form_state['redirect'])) {
    $data['redirect'] = $form_state['redirect'];
  }

  // form:redirect
  if (array_key_exists('redirect', $form) && !empty($form_state['redirect'])) {
    $data['redirect'] = $form['redirect'];
  }

  // Messages: Status
  if (array_key_exists('status', $messages)) {
    $data['messages_status'] = $messages['status'];
  }

  // Messages warning
  if (array_key_exists('warning', $messages)) {
    $data['messages_warning'] = $messages['warning'];
  }
  $out = ajax_build($data);
  ajax_out($out);
  return TRUE;
}