You are here

public function ConfigEntityRevisionsRevisionStorageHandler::getLatestPublishedRevisionId in Config Entity Revisions 8.2

Gets the latest published revision ID of the entity.

Parameters

int $ignore: A revision ID to ignore (optional).

Return value

int The identifier of the latest published revision of the entity, or NULL if the entity does not have a published revision.

Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface::getLatestPublishedRevisionId

2 calls to ConfigEntityRevisionsRevisionStorageHandler::getLatestPublishedRevisionId()
ConfigEntityRevisionsRevisionStorageHandler::getLatestPublishedRevision in src/Entity/Handler/ConfigEntityRevisionsRevisionStorageHandler.php
Gets the latest published revision ID of the entity.
ConfigEntityRevisionsRevisionStorageHandler::getLatestPublishedRevisionOrLatestId in src/Entity/Handler/ConfigEntityRevisionsRevisionStorageHandler.php
Gets the latest revision ID of the entity.

File

src/Entity/Handler/ConfigEntityRevisionsRevisionStorageHandler.php, line 160

Class

ConfigEntityRevisionsRevisionStorageHandler
Class ConfigEntityRevisionsRevisionStorageHandler.

Namespace

Drupal\config_entity_revisions\Entity\Handler

Code

public function getLatestPublishedRevisionId($ignore = NULL) {
  $this
    ->ensureRevisionStatesLoaded();
  foreach ($this->revisionStates as $state) {
    if (!is_null($ignore) && $state->revision == $ignore) {
      continue;
    }
    if ($state->published) {
      return $state->revision;
    }
  }
  return NULL;
}