function 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_moderationCode
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.
