public function ContentTranslationHandler::retranslate in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::retranslate()
Marks translations as outdated.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity being translated.
string $langcode: (optional) The language code of the updated language: all the other translations will be marked as outdated. Defaults to the entity language.
Overrides ContentTranslationHandlerInterface::retranslate
1 call to ContentTranslationHandler::retranslate()
- ContentTranslationHandler::entityFormEntityBuild in core/
modules/ content_translation/ src/ ContentTranslationHandler.php - Entity builder method.
File
- core/
modules/ content_translation/ src/ ContentTranslationHandler.php, line 277
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translationCode
public function retranslate(EntityInterface $entity, $langcode = NULL) {
$updated_langcode = !empty($langcode) ? $langcode : $entity
->language()
->getId();
foreach ($entity
->getTranslationLanguages() as $langcode => $language) {
$this->manager
->getTranslationMetadata($entity
->getTranslation($langcode))
->setOutdated($langcode != $updated_langcode);
}
}