public function LingotekSetupController::handshake in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8 src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 8.2 src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 4.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.1.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.3.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.4.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.5.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.6.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.7.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
- 3.8.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::handshake()
1 string reference to 'LingotekSetupController::handshake'
File
- src/
Controller/ LingotekSetupController.php, line 31
Class
- LingotekSetupController
- Returns responses for lingotek module setup routes.
Namespace
Drupal\lingotek\ControllerCode
public function handshake() {
if ($this
->receivedToken()) {
$this
->saveToken($this
->receivedToken());
$config = \Drupal::configFactory()
->getEditable('lingotek.settings');
$config
->set('account.use_production', TRUE)
->save();
$account_info = $this
->fetchAccountInfo();
$this
->saveAccountInfo($account_info);
$this
->messenger()
->addStatus($this
->t('Your account settings have been saved.'));
$this->logger
->notice('Account connected to Lingotek.');
// No need to show the username and token if everything worked correctly
// Just go to the community page
return $this
->redirect('lingotek.setup_community');
}
else {
return [
'#type' => 'markup',
'#markup' => $this
->t('Connecting... Please wait to be redirected'),
'#attached' => [
'library' => [
'lingotek/lingotek.connect',
],
],
];
}
}