You are here

public function LingotekContentModerationHandler::isModerationEnabled in Lingotek Translation 3.3.x

Same name and namespace in other branches
  1. 8.2 src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  2. 4.0.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  3. 3.0.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  4. 3.1.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  5. 3.2.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  6. 3.4.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  7. 3.5.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  8. 3.6.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  9. 3.7.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()
  10. 3.8.x src/Moderation/LingotekContentModerationHandler.php \Drupal\lingotek\Moderation\LingotekContentModerationHandler::isModerationEnabled()

Checks if the moderation is enabled for this entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The content entity.

Return value

bool If moderation is enabled, returns TRUE. Returns FALSE otherwise.

Overrides LingotekModerationHandlerInterface::isModerationEnabled

1 call to LingotekContentModerationHandler::isModerationEnabled()
LingotekContentModerationHandler::shouldModerationPreventUpload in src/Moderation/LingotekContentModerationHandler.php
Checks if we should prevent upload based on content moderation settings.

File

src/Moderation/LingotekContentModerationHandler.php, line 164

Class

LingotekContentModerationHandler
Content moderation handler managing the Lingotek integration.

Namespace

Drupal\lingotek\Moderation

Code

public function isModerationEnabled(EntityInterface $entity) {
  $moderationEnabled = FALSE;
  $moderationClass = $entity
    ->getEntityType()
    ->getHandlerClass('moderation');
  if ($moderationClass) {
    $implements = class_implements($moderationClass);
    $moderationEnabled = in_array('Drupal\\content_moderation\\Entity\\Handler\\ModerationHandlerInterface', $implements);
  }
  return $moderationEnabled;
}