You are here

public function ContentTranslationManager::getTranslationMetadata in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::getTranslationMetadata()

Returns an instance of the Content translation metadata.

Parameters

\Drupal\Core\Entity\EntityInterface $translation: The entity translation whose metadata needs to be retrieved.

Return value

\Drupal\content_translation\ContentTranslationMetadataWrapperInterface An instance of the content translation metadata.

Overrides ContentTranslationManagerInterface::getTranslationMetadata

File

core/modules/content_translation/src/ContentTranslationManager.php, line 52

Class

ContentTranslationManager
Provides common functionality for content translation.

Namespace

Drupal\content_translation

Code

public function getTranslationMetadata(EntityInterface $translation) {

  // We need a new instance of the metadata handler wrapping each translation.
  $entity_type = $translation
    ->getEntityType();
  $class = $entity_type
    ->get('content_translation_metadata');
  return new $class($translation, $this
    ->getTranslationHandler($entity_type
    ->id()));
}