function ModerationInformation::getDefaultRevisionId

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getDefaultRevisionId()
  2. 8.9.x core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getDefaultRevisionId()
  3. 11.x core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getDefaultRevisionId()
1 call to ModerationInformation::getDefaultRevisionId()
ModerationInformation::hasPendingRevision in core/modules/content_moderation/src/ModerationInformation.php

File

core/modules/content_moderation/src/ModerationInformation.php, line 90

Class

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

Namespace

Drupal\content_moderation

Code

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);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.