You are here

public function LingotekApi::removeTranslationTarget in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::removeTranslationTarget()
  2. 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::removeTranslationTarget()
  3. 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::removeTranslationTarget()
  4. 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::removeTranslationTarget()
  5. 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::removeTranslationTarget()

Removes a target language to an existing Lingotek Document or Project.

Parameters

int $lingotek_document_id: The document from which the translation target should be removed. Or null if the target will be removed from the project.

int $lingotek_project_id: The project from which the translation target should be removed. Or null if the target will be removed from a document instead.

string $lingotek_locale: The two letter code representing the language which should be added as a translation target.

string $workflow_id: The optional workflow to associate with this target. If omitted, the project's default workflow will be applied.

Return value

bool TRUE on success, or FALSE on error.

File

lib/Drupal/lingotek/LingotekApi.php, line 431
Defines Drupal\lingotek\LingotekApi

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

public function removeTranslationTarget($lingotek_document_id, $lingotek_project_id, $lingotek_locale) {
  $parameters = array(
    'targetLanguage' => $lingotek_locale,
  );
  if (isset($lingotek_document_id) && !isset($lingotek_project_id)) {
    $parameters['documentId'] = $lingotek_document_id;
  }
  elseif (isset($lingotek_project_id) && !isset($lingotek_document_id)) {
    $parameters['projectId'] = $lingotek_project_id;
  }
  if ($old_translation_target = $this
    ->request('removeTranslationTarget', $parameters)) {
    return $old_translation_target->results == 'success' ? TRUE : FALSE;
  }
  else {
    return FALSE;
  }
}