public function LingotekApi::getDocumentContent in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 8.2 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 4.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.1.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.2.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.3.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.4.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.5.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.7.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
- 3.8.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getDocumentContent()
Gets the document content from Lingotek.
Parameters
string $doc_id: The document id.
Return value
string The content.
Throws
\Drupal\lingotek\Exception\LingotekApiException
Overrides LingotekApiInterface::getDocumentContent
File
- src/
Remote/ LingotekApi.php, line 185
Class
- LingotekApi
- A simple connector to the Lingotek Translation API.
Namespace
Drupal\lingotek\RemoteCode
public function getDocumentContent($doc_id) {
try {
$this->logger
->debug('Lingotek::getDocumentContent called with id ' . $doc_id);
$response = $this->lingotekClient
->get('/api/document/' . $doc_id . '/content');
} catch (\Exception $e) {
throw new LingotekApiException('Failed to get document: ' . $e
->getMessage());
}
return $response
->getBody()
->getContents();
}