getLatestTranslationAffectedRevision example

    $langcode = $this->languageManager->isMultilingual()
      ? $this->getContentLanguageFromContexts($contexts)
      : $this->languageManager->getDefaultLanguage()->getId();

    $entities = $this->entityTypeManager
      ->getStorage($entity_type_id)
      ->loadMultiple($entity_ids);

    foreach ($entities as $id => $entity) {
      // Retrieve the fittest revision, if needed.       if ($entity instanceof RevisionableInterface && $entity->getEntityType()->isRevisionable()) {
        $entity = $this->getLatestTranslationAffectedRevision($entity$langcode);
      }

      // Retrieve the fittest translation, if needed.       if ($entity instanceof TranslatableInterface) {
        $entity = $this->getTranslationFromContext($entity$langcode);
      }

      $active[$id] = $entity;
    }

    return $active;
  }
Home | Imprint | This part of the site doesn't use cookies.