You are here

public function Lingotek::downloadDocument in Lingotek Translation 8

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

Overrides LingotekInterface::downloadDocument

File

src/Lingotek.php, line 378
Contains \Drupal\lingotek\Lingotek.

Class

Lingotek

Namespace

Drupal\lingotek

Code

public function downloadDocument($doc_id, $locale) {

  // For now, a passthrough to the API object so the controllers do not
  // need to include that class.
  $response = $this->api
    ->getTranslation($doc_id, $locale);
  if ($response
    ->getStatusCode() == Response::HTTP_OK) {
    return json_decode($response
      ->getBody(), TRUE);
  }
  return FALSE;
}