You are here

function dialog_user_user_login_submit in Dialog 7.2

Ajax callback for the user login form.

See also

dialog_user_form_user_login_alter()

1 string reference to 'dialog_user_user_login_submit'
dialog_user_form_user_login_alter in modules/dialog_user/dialog_user.module
Implement hook_form_FORM_ID_alter().

File

modules/dialog_user/dialog_user.module, line 73
Provides dialog integration for user.module.

Code

function dialog_user_user_login_submit($form, &$form_state) {

  // Display form errors, otherwise close the dialog and reload the page.
  if (form_get_errors()) {
    unset($form['#prefix'], $form['#suffix']);
    $status_messages = array(
      '#theme' => 'status_messages',
    );
    $output = drupal_render($form);
    $output = '<div>' . drupal_render($status_messages) . $output . '</div>';
    $commands[] = ajax_command_html('#dialog-user-user-login', $output);
  }
  else {
    $commands[] = dialog_command_close_modal_dialog();
    $commands[] = dialog_command_reload();
  }
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}