You are here

public function LingotekControllerBase::connected in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 8 src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  2. 8.2 src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  3. 3.0.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  4. 3.1.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  5. 3.2.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  6. 3.3.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  7. 3.4.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  8. 3.5.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  9. 3.6.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  10. 3.7.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()
  11. 3.8.x src/Controller/LingotekControllerBase.php \Drupal\lingotek\Controller\LingotekControllerBase::connected()

Checks if site is connected to Lingotek.

Return value

boolean TRUE if connected, FALSE otherwise.

File

src/Controller/LingotekControllerBase.php, line 101

Class

LingotekControllerBase
Base class for handling all Lingotek-related routes.

Namespace

Drupal\lingotek\Controller

Code

public function connected() {
  $access_token = $this->request->query
    ->get('access_token');
  if ($access_token) {
    $config = \Drupal::configFactory()
      ->getEditable('lingotek.settings');
    $config
      ->set('access_token', $access_token);
    $config
      ->save();
    return TRUE;
  }
  return FALSE;
}