public function SimpleFbConnectController::redirectToFb in Simple FB Connect 8.2
Same name and namespace in other branches
- 8.3 src/Controller/SimpleFbConnectController.php \Drupal\simple_fb_connect\Controller\SimpleFbConnectController::redirectToFb()
Response for path 'user/simple-fb-connect'.
Redirects the user to FB for authentication.
1 string reference to 'SimpleFbConnectController::redirectToFb'
File
- src/
Controller/ SimpleFbConnectController.php, line 56 - Contains \Drupal\simple_fb_connect\Controller\SimpleFbConnectController.
Class
- SimpleFbConnectController
- Returns responses for Simple FB Connect module routes.
Namespace
Drupal\simple_fb_connect\ControllerCode
public function redirectToFb() {
// Validate configuration.
if (!$this->fbManager
->validateConfig()) {
drupal_set_message(t('Simple FB Connect not configured properly. Contact site administrator.'), 'error');
return $this
->redirect('user.login');
}
// Save post login path to session if it was set as query parameter.
if ($post_login_path = $this->postLoginManager
->getPostLoginPathFromRequest()) {
$this->postLoginManager
->savePostLoginPathToSession($post_login_path);
}
// Redirect the user to FB for authentication.
$fb_login_url = $this->fbManager
->getFbLoginUrl();
return new TrustedRedirectResponse($fb_login_url);
}