public function ModerationInformation::getDefaultRevisionId in Config Entity Revisions 8.2
Returns the revision ID of the default revision for the specified entity.
Parameters
string $entity_type_id: The entity type ID.
int $entity_id: The entity ID.
Return value
int The revision ID of the default revision, or NULL if the entity was not found.
Overrides ModerationInformation::getDefaultRevisionId
1 call to ModerationInformation::getDefaultRevisionId()
- ModerationInformation::hasPendingRevision in src/
ModerationInformation.php - Determines if a pending revision exists for the specified entity.
File
- src/
ModerationInformation.php, line 127
Class
- ModerationInformation
- Class ModerationInformation.
Namespace
Drupal\config_entity_revisionsCode
public function getDefaultRevisionId($entity_type_id, $entity_id) {
if ($storage = $this->entityTypeManager
->getStorage($entity_type_id)) {
$result = $storage
->getQuery()
->currentRevision()
->condition($this->entityTypeManager
->getDefinition($entity_type_id)
->getKey('id'), $entity_id)
->accessCheck(FALSE)
->execute();
if ($result) {
return key($result);
}
}
}