ContentTranslationHandler::retranslate

public ContentTranslationHandler::retranslate(EntityInterface $entity, $langcode = NULL)

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

File

core/modules/content_translation/src/ContentTranslationHandler.php, line 229

Class

ContentTranslationHandler
Base class for content translation handlers.

Namespace

Drupal\content_translation

Code

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);
  }
}
doc_Drupal
2016-10-29 08:58:16
Comments
Leave a Comment

Please login to continue.