function ModerationInformation::isLiveRevision

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::isLiveRevision()
  2. 10 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::isLiveRevision()
  3. 11.x core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::isLiveRevision()

Overrides ModerationInformationInterface::isLiveRevision

File

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

Class

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

Namespace

Drupal\content_moderation

Code

public function isLiveRevision(ContentEntityInterface $entity) {
    $workflow = $this->getWorkflowForEntity($entity);
    return $entity->isLatestRevision() && $entity->isDefaultRevision() && $entity->moderation_state->value && $workflow->getTypePlugin()
        ->getState($entity->moderation_state->value)
        ->isPublishedState();
}

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