You are here

public function Lingotek::getDocumentStatus in Lingotek Translation 3.4.x

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

Gets a document status.

Parameters

string $doc_id: The document id.

Return value

bool TRUE if the document exists. FALSE if not.

Overrides LingotekInterface::getDocumentStatus

File

src/Lingotek.php, line 703

Class

Lingotek
The connecting class between Drupal and Lingotek

Namespace

Drupal\lingotek

Code

public function getDocumentStatus($doc_id) {

  // For now, a passthrough to the API object so the controllers do not
  // need to include that class.
  try {
    $response = $this->api
      ->getDocumentStatus($doc_id);
    if ($response
      ->getStatusCode() == Response::HTTP_OK) {

      // If an exception didn't happen, the document is succesfully imported.
      // The status value there is related with translation status, so we must
      // ignore it.
      return TRUE;
    }
  } catch (LingotekApiException $exception) {
    return FALSE;
  }
  return FALSE;
}