public function TwitterAuthController::getSdk in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.2 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.3 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.4 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.5 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.6 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.7 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
- 8.8 modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php \Drupal\social_auth_twitter\Controller\TwitterAuthController::getSdk()
Returns the SDK instance or RedirectResponse when error occurred.
Parameters
string $type: Type of action, "login" or "register".
Return value
mixed|\Symfony\Component\HttpFoundation\RedirectResponse Returns an instance of the SDK or a Redirect Response.
4 calls to TwitterAuthController::getSdk()
- TwitterAuthController::getProfile in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterAuthController.php - Loads access token, then loads profile.
- TwitterAuthController::getRedirectResponse in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterAuthController.php - Returns the redirect response.
- TwitterAuthController::userLoginCallback in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterAuthController.php - Authorizes the user after redirect from Twitter.
- TwitterAuthController::userRegisterCallback in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterAuthController.php - Registers the new account after redirect from Twitter.
File
- modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterAuthController.php, line 228
Class
- TwitterAuthController
- Manages requests to Twitter API.
Namespace
Drupal\social_auth_twitter\ControllerCode
public function getSdk($type) {
if ($this->sdk) {
return $this->sdk;
}
$network_manager = $this->networkManager
->createInstance('social_auth_twitter');
if (!$network_manager
->isActive()) {
drupal_set_message($this
->t('@network is disabled. Contact the site administrator', [
'@network' => $this
->t('Twitter'),
]), 'error');
return $this
->redirect('user.' . $type);
}
if (!($this->sdk = $network_manager
->getSdk())) {
drupal_set_message($this
->t('@network Auth not configured properly. Contact the site administrator.', [
'@network' => $this
->t('Twitter'),
]), 'error');
return $this
->redirect('user.' . $type);
}
return $this->sdk;
}