function ModerationInformation::isLiveRevision

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

File

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

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.