You are here

function dialog_user_user_register_form_submit in Dialog 7.2

Ajax callback for the user register form.

See also

dialog_user_form_user_register_form_alter()

1 string reference to 'dialog_user_user_register_form_submit'
dialog_user_form_user_register_form_alter in modules/dialog_user/dialog_user.module
Implement hook_form_FORM_ID_alter().

File

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

Code

function dialog_user_user_register_form_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-register-form', $output);
  }
  else {
    $commands[] = dialog_command_close_modal_dialog();
    $commands[] = dialog_command_reload();
  }
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}