public function NotificationInformation::getLatestRevision in Content Moderation Notifications 8.3
Same name and namespace in other branches
- 8.2 src/NotificationInformation.php \Drupal\content_moderation_notifications\NotificationInformation::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 NotificationInformationInterface::getLatestRevision
File
- src/
NotificationInformation.php, line 126
Class
- NotificationInformation
- Service for notification related questions about the moderated entity.
Namespace
Drupal\content_moderation_notificationsCode
public function getLatestRevision($entity_type_id, $entity_id) {
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
if ($storage instanceof RevisionableStorageInterface && ($revision_id = $storage
->getLatestRevisionId($entity_id))) {
return $storage
->loadRevision($revision_id);
}
}