You are here

function fancy_login_user_pass_ajax_callback in Fancy Login 7.3

Same name and namespace in other branches
  1. 8.2 fancy_login.module \fancy_login_user_pass_ajax_callback()
  2. 3.0.x fancy_login.module \fancy_login_user_pass_ajax_callback()

Ajax callback function for fancy_login_user_pass submit button.

1 string reference to 'fancy_login_user_pass_ajax_callback'
fancy_login_form_alter in ./fancy_login.module
Implements hook_form_alter().

File

./fancy_login.module, line 463
Holds hooks for the Fancy Login module.

Code

function fancy_login_user_pass_ajax_callback($form, &$form_state) {
  $commands = array();
  $form = render($form);
  $message_data = drupal_get_messages(NULL, FALSE);

  // Check to see if there were any errors with the form submission.
  if (!count($message_data['error'])) {
    $commands[] = array(
      'command' => 'fancyLoginClosePopup',
    );
  }
  $messages = theme('status_messages');
  $scripts = drupal_add_js();
  if (!empty($scripts['settings'])) {
    $settings = '<script type="text/javascript">jQuery.extend(Drupal.settings, ';
    $settings .= drupal_json_encode(call_user_func_array('array_merge_recursive', $scripts['settings']['data']));
    $settings .= ');</script>';
  }
  $commands[] = ajax_command_replace(NULL, $messages . $form . $settings);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}