You are here

public function LingotekContentTranslationService::getLastUploaded in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getLastUploaded()
  2. 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getLastUploaded()
  3. 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getLastUploaded()
  4. 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getLastUploaded()
  5. 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getLastUploaded()

Gets the 'initial upload' time metadata for the given entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity which we want the document id.

Return value

\Drupal\Core\Entity\ContentEntityInterface Returns the timestamp.

Overrides LingotekContentTranslationServiceInterface::getLastUploaded

1 call to LingotekContentTranslationService::getLastUploaded()
LingotekContentTranslationService::checkForTimeout in src/LingotekContentTranslationService.php
Checks the time elapsed since the last upload and sets the entity to error if the max time has elapsed.

File

src/LingotekContentTranslationService.php, line 2292

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function getLastUploaded(ContentEntityInterface $entity) {
  if (!$entity->lingotek_metadata->entity) {
    $entity->lingotek_metadata->entity = LingotekContentMetadata::loadByTargetId($entity
      ->getEntityTypeId(), $entity
      ->id());
  }

  /** @var \Drupal\lingotek\Entity\LingotekContentMetadata $metadata */
  $metadata = $entity->lingotek_metadata->entity;
  return $metadata
    ->getLastUploaded();
}