You are here

function fancy_login_user_register_form_ajax_callback in Fancy Login 7.3

Ajax callback function for fancy_login_user_register_form submit button.

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

File

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

Code

function fancy_login_user_register_form_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 (!isset($message_data['error']) || !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,
  );
}