You are here

public function ModerationInformation::isModeratedEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::isModeratedEntity()

Determines if an entity is moderated.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity we may be moderating.

Return value

bool TRUE if this entity is moderated, FALSE otherwise.

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;
  }
  return $this
    ->shouldModerateEntitiesOfBundle($entity
    ->getEntityType(), $entity
    ->bundle());
}