You are here

public function FancyLoginController::ajaxCallback in Fancy Login 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Controller/FancyLoginController.php \Drupal\fancy_login\Controller\FancyLoginController::ajaxCallback()

Provides the ajax callback response for the Fancy Login module.

Overrides FancyLoginControllerInterface::ajaxCallback

1 string reference to 'FancyLoginController::ajaxCallback'
fancy_login.routing.yml in ./fancy_login.routing.yml
fancy_login.routing.yml

File

src/Controller/FancyLoginController.php, line 45

Class

FancyLoginController
The ajax controller for the fancy login module.

Namespace

Drupal\fancy_login\Controller

Code

public function ajaxCallback($type) {
  $response = new AjaxResponse();
  switch ($type) {
    case "password":
      $form = $this->formBuilder
        ->getForm('Drupal\\fancy_login\\Form\\FancyLoginPasswordForm');
      break;
    case "login":
      $form = $this->formBuilder
        ->getForm('Drupal\\fancy_login\\Form\\FancyLoginLoginForm');
      unset($form['#prefix'], $form['#suffix']);
      break;
  }
  $response
    ->addCommand(new FancyLoginLoadFormCommand($form));
  return $response;
}