public function LingotekContentTranslationService::setLastUploaded in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUploaded()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUploaded()
- 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUploaded()
- 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUploaded()
- 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUploaded()
Updates the 'initial upload' time metadata to the current request time.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity which we want the document id.
int $timestamp: The timestamp we want to store.
Return value
\Drupal\Core\Entity\ContentEntityInterface Returns the entity.
Overrides LingotekContentTranslationServiceInterface::setLastUploaded
1 call to LingotekContentTranslationService::setLastUploaded()
- LingotekContentTranslationService::uploadDocument in src/
LingotekContentTranslationService.php - Uploads a document to the Lingotek service.
File
- src/
LingotekContentTranslationService.php, line 2134
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
public function setLastUploaded(ContentEntityInterface $entity, int $timestamp) {
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;
$metadata
->setLastUploaded($timestamp)
->save();
return $entity;
}