public function TwitterLinkController::getSdk in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.2 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.3 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.4 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.5 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.6 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.7 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
- 8.8 modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php \Drupal\social_auth_twitter\Controller\TwitterLinkController::getSdk()
Returns the SDK instance or RedirectResponse when error occurred.
Return value
mixed|\Symfony\Component\HttpFoundation\RedirectResponse Can return an SDK instance or a RedirectResponse to the user edit form.
2 calls to TwitterLinkController::getSdk()
- TwitterLinkController::linkAccount in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterLinkController.php - Response for path 'social-api/link/linkedin'.
- TwitterLinkController::linkAccountCallback in modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterLinkController.php - Makes joining between account on this site and account on social network.
File
- modules/
custom/ social_auth_twitter/ src/ Controller/ TwitterLinkController.php, line 147
Class
- TwitterLinkController
- Class TwitterLinkController.
Namespace
Drupal\social_auth_twitter\ControllerCode
public function getSdk() {
$network_manager = $this->networkManager
->createInstance('social_auth_twitter');
if (!$network_manager
->isActive()) {
drupal_set_message($this
->t('@network is disallowed. Contact site administrator.', [
'@network' => $this
->t('Twitter'),
]), 'error');
return $this
->redirect('entity.user.edit_form', [
'user' => $this
->currentUser()
->id(),
]);
}
if (!($sdk = $network_manager
->getSdk())) {
drupal_set_message($this
->t('@network Auth not configured properly. Contact site administrator.', [
'@network' => $this
->t('Twitter'),
]), 'error');
return $this
->redirect('entity.user.edit_form', [
'user' => $this
->currentUser()
->id(),
]);
}
return $sdk;
}