function ModerationInformation::isModeratedEntity

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

Overrides ModerationInformationInterface::isModeratedEntity

1 call to ModerationInformation::isModeratedEntity()
ModerationInformation::hasPendingRevision in core/modules/content_moderation/src/ModerationInformation.php
Determines if a pending revision exists for the specified entity.

File

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

Class

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

Namespace

Drupal\content_moderation

Code

public function isModeratedEntity(EntityInterface $entity) {
    if (!$entity instanceof ContentEntityInterface) {
        return FALSE;
    }
    if (!$this->shouldModerateEntitiesOfBundle($entity->getEntityType(), $entity->bundle())) {
        return FALSE;
    }
    return $this->entityTypeManager
        ->getHandler($entity->getEntityTypeId(), 'moderation')
        ->isModeratedEntity($entity);
}

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