function lingotek_entity_translation_insert in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 lingotek.module \lingotek_entity_translation_insert()
- 4.0.x lingotek.module \lingotek_entity_translation_insert()
- 3.0.x lingotek.module \lingotek_entity_translation_insert()
- 3.1.x lingotek.module \lingotek_entity_translation_insert()
- 3.2.x lingotek.module \lingotek_entity_translation_insert()
- 3.3.x lingotek.module \lingotek_entity_translation_insert()
- 3.4.x lingotek.module \lingotek_entity_translation_insert()
- 3.5.x lingotek.module \lingotek_entity_translation_insert()
- 3.6.x lingotek.module \lingotek_entity_translation_insert()
- 3.7.x lingotek.module \lingotek_entity_translation_insert()
- 3.8.x lingotek.module \lingotek_entity_translation_insert()
Implements hook_entity_translation_insert().
File
- ./
lingotek.module, line 425 - lingotek.module
Code
function lingotek_entity_translation_insert(ContentEntityInterface $translation) {
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_config */
$lingotek_config = \Drupal::service('lingotek.configuration');
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
if ($lingotek_config
->isEnabled($translation
->getEntityTypeId(), $translation
->bundle())) {
$status = $translation_service
->getTargetStatus($translation, $translation
->language()
->getId());
// As untracked is a default, we save it anyway.
if ($status === Lingotek::STATUS_REQUEST || $status === Lingotek::STATUS_UNTRACKED) {
$translation = $translation_service
->setTargetStatus($translation, $translation
->language()
->getId(), Lingotek::STATUS_UNTRACKED, FALSE);
}
}
}