You are here

function dialog_user_ajax_callback in Dialog 7

Menu callback for our ajax links.

1 string reference to 'dialog_user_ajax_callback'
dialog_user_menu in modules/dialog_user/dialog_user.module
Implement hook_menu().

File

modules/dialog_user/dialog_user.module, line 31

Code

function dialog_user_ajax_callback($type, $js) {
  switch ($type) {
    case 'login':
      $title = t('Login');
      $form_id = 'user_login';
      $path = 'user/login';
      break;
    case 'register':
      $title = t('Register');
      $form_id = 'user_register_form';
      $path = 'user/register';
      break;
    case 'password':

      // @TODO Why doesn't request new password work?
      $title = t('Request new password');
      $form_id = 'user_pass';
      $path = 'user/pass';
      break;
  }
  if ($js) {
    dialog_display(TRUE);
    $content = drupal_get_form($form_id);
    $output[] = dialog_command_display($content, array(
      'title' => $title,
    ));
    ajax_deliver(array(
      '#type' => 'ajax',
      '#commands' => $output,
    ));
  }
  else {
    drupal_goto($path);
  }
}