ModerationInformation::shouldModerateEntitiesOfBundle

public ModerationInformation::shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, $bundle)

Determines if an entity type/bundle entities should be moderated.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition to check.

string $bundle: The bundle to check.

Return value

bool TRUE if an entity type/bundle entities should be moderated, FALSE otherwise.

Overrides ModerationInformationInterface::shouldModerateEntitiesOfBundle

File

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

Class

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

Namespace

Drupal\content_moderation

Code

public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, $bundle) {
  if ($this->canModerateEntitiesOfEntityType($entity_type)) {
    $bundle_entity = $this->entityTypeManager->getStorage($entity_type->getBundleEntityType())->load($bundle);
    if ($bundle_entity) {
      return $bundle_entity->getThirdPartySetting('content_moderation', 'enabled', FALSE);
    }
  }
  return FALSE;
}
doc_Drupal
2016-10-29 09:28:34
Comments
Leave a Comment

Please login to continue.