You are here

function fancy_login_ajax_callback in Fancy Login 6.2

Same name and namespace in other branches
  1. 7.3 includes/fancy_login.pages.inc \fancy_login_ajax_callback()

Page callback function for fancy_login/ajax/%

This function performs the AJAX callback for fancy_login.js which makes AJAX commands requesting different forms, and inserting them into the Fancy Login login block.

1 string reference to 'fancy_login_ajax_callback'
fancy_login_menu in ./fancy_login.module
Implementation of hook_menu()

File

includes/fancy_login.pages.inc, line 189

Code

function fancy_login_ajax_callback($type) {
  switch ($type) {
    case "password":
      module_load_include('inc', 'user', 'user.pages');
      $form = drupal_get_form('fancy_login_user_pass');
      break;
    case "register":
      $form = drupal_get_form('fancy_login_user_register');
      break;
    case "login":
      $form = drupal_get_form('fancy_login_user_login_block');
      break;
  }
  $javascript = drupal_add_js(NULL, NULL);
  if (isset($javascript['setting'])) {
    $settings = '<script type="text/javascript">jQuery.extend(Drupal.settings, ' . drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) . ');</script>';
  }
  $return = array(
    'content' => $form . $settings,
    'status' => TRUE,
    'type' => $type,
  );
  die(drupal_json($return));
}