protected function LingotekContentTranslationService::clearTargetStatuses in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
- 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
Clear the target statuses.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity:
1 call to LingotekContentTranslationService::clearTargetStatuses()
- LingotekContentTranslationService::checkTargetStatuses in src/
LingotekContentTranslationService.php - Gets the current status of all the target translations.
File
- src/
LingotekContentTranslationService.php, line 215
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
protected function clearTargetStatuses(ContentEntityInterface &$entity) {
$profile = $this->lingotekConfiguration
->getEntityProfile($entity);
if ($profile
->id() === Lingotek::PROFILE_DISABLED || $this
->getSourceStatus($entity) === Lingotek::STATUS_CANCELLED) {
return FALSE;
}
// Clear the target statuses. As we save the source status with the target,
// we need to keep that one.
$source_status = $this
->getSourceStatus($entity);
$metadata =& $entity->lingotek_metadata->entity;
if ($metadata
->hasField('translation_status') && count($metadata->translation_status) > 0) {
$metadata->translation_status = NULL;
}
$this
->setTargetStatus($entity, $entity
->getUntranslated()
->language()
->getId(), $source_status);
}