private function PanelizerIPEController::getLatestRevision in Lightning Workflow 8.3
Loads the latest revision of an entity.
This is a shim around ModerationInformationInterface::getLatestRevision(), which was replaced by calling methods on the entity storage handler in Drupal 8.8.
Parameters
string $entity_type_id: The entity type ID.
mixed $entity_id: The entity ID.
Return value
\Drupal\Core\Entity\EntityInterface The latest revision of the entity. If one could not be found, the default revision is returned instead.
1 call to PanelizerIPEController::getLatestRevision()
- PanelizerIPEController::revertToDefault in src/
Controller/ PanelizerIPEController.php
File
- src/
Controller/ PanelizerIPEController.php, line 91
Class
- PanelizerIPEController
- Controller for Panels IPE routes that are specific to Panelizer.
Namespace
Drupal\lightning_workflow\ControllerCode
private function getLatestRevision($entity_type_id, $entity_id) {
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
if ($storage instanceof RevisionableStorageInterface && method_exists($storage, 'getLatestRevisionId')) {
$revision_id = $storage
->getLatestRevisionId($entity_id);
return isset($revision_id) ? $storage
->loadRevision($revision_id) : $storage
->load($entity_id);
}
else {
// Use call_user_func() here because our deprecation testing tools are not
// smart enough to recognize the actual code path that leads here.
return call_user_func([
$this->modInfo,
'getLatestRevision',
], $entity_type_id, $entity_id);
}
}