You are here

public function ModerationInformation::getLatestRevision in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/ModerationInformation.php \Drupal\workbench_moderation\ModerationInformation::getLatestRevision()

Loads the latest revision of a specific entity.

Parameters

string $entity_type_id: The entity type ID.

int $entity_id: The entity ID.

Return value

\Drupal\Core\Entity\ContentEntityInterface|null The latest entity revision or NULL, if the entity type / entity doesn't exist.

Overrides ModerationInformationInterface::getLatestRevision

File

src/ModerationInformation.php, line 149

Class

ModerationInformation
General service for moderation-related questions about Entity API.

Namespace

Drupal\workbench_moderation

Code

public function getLatestRevision($entity_type_id, $entity_id) {
  if ($latest_revision_id = $this
    ->getLatestRevisionId($entity_type_id, $entity_id)) {
    return $this->entityTypeManager
      ->getStorage($entity_type_id)
      ->loadRevision($latest_revision_id);
  }
}