You are here

public function LingotekContentTranslationService::setDocumentId in Lingotek Translation 3.7.x

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

Sets the Lingotek document id for a given entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface &$entity: The entity which we want to set a document id.

$doc_id: The document id in the Lingotek platform.

Return value

\Drupal\Core\Entity\ContentEntityInterface The entity.

Overrides LingotekContentTranslationServiceInterface::setDocumentId

12 calls to LingotekContentTranslationService::setDocumentId()
LingotekContentTranslationService::addTarget in src/LingotekContentTranslationService.php
Request a translation for a given entity in the given locale.
LingotekContentTranslationService::cancelDocument in src/LingotekContentTranslationService.php
Cancels a document from the server.
LingotekContentTranslationService::cancelDocumentTarget in src/LingotekContentTranslationService.php
Cancels a translation for a given entity in the given locale.
LingotekContentTranslationService::checkSourceStatus in src/LingotekContentTranslationService.php
Checks the source is uploaded correctly.
LingotekContentTranslationService::checkTargetStatus in src/LingotekContentTranslationService.php
Gets the current status of the target translation.

... See full list

File

src/LingotekContentTranslationService.php, line 556

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function setDocumentId(ContentEntityInterface &$entity, $doc_id) {
  if ($entity->lingotek_metadata->entity === NULL) {
    $entity->lingotek_metadata->entity = LingotekContentMetadata::loadByTargetId($entity
      ->getEntityTypeId(), $entity
      ->id());
  }
  $entity->lingotek_processed = TRUE;
  $entity->lingotek_metadata->entity
    ->setDocumentId($doc_id);
  $entity->lingotek_metadata->entity
    ->save();
  return $entity;
}