You are here

private function EntityOperations::entityLeveragesContentModeration in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x src/EntityOperations.php \Drupal\radioactivity\EntityOperations::entityLeveragesContentModeration()

Determines if the entity is moderated by the Content Moderation module.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check.

Return value

bool TRUE if the entity leverages content moderation, FALSE otherwise.

1 call to EntityOperations::entityLeveragesContentModeration()
EntityOperations::entityPresave in src/EntityOperations.php
Acts on an entity and set published status based on the moderation state.

File

src/EntityOperations.php, line 66

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\radioactivity

Code

private function entityLeveragesContentModeration(EntityInterface $entity) {
  if (!$entity instanceof ContentEntityInterface) {
    return FALSE;
  }
  if ($entity
    ->getEntityType()
    ->hasHandlerClass('moderation')) {
    $bundles = $this->bundleInfo
      ->getBundleInfo($entity
      ->getEntityType()
      ->id());
    return isset($bundles[$entity
      ->bundle()]['workflow']);
  }
  return FALSE;
}