You are here

public function LingotekWorkbenchModerationHandler::isModerationEnabled in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  2. 4.0.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  3. 3.2.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  4. 3.3.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  5. 3.4.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  6. 3.5.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  7. 3.6.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  8. 3.7.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::isModerationEnabled()
  9. 3.8.x src/Moderation/LingotekWorkbenchModerationHandler.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationHandler::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 LingotekWorkbenchModerationHandler::isModerationEnabled()
LingotekWorkbenchModerationHandler::shouldModerationPreventUpload in src/Moderation/LingotekWorkbenchModerationHandler.php
Checks if we should prevent upload based on content moderation settings.

File

src/Moderation/LingotekWorkbenchModerationHandler.php, line 117

Class

LingotekWorkbenchModerationHandler
Workbench moderation handler managing the Lingotek integration.

Namespace

Drupal\lingotek\Moderation

Code

public function isModerationEnabled(EntityInterface $entity) {
  $moderationEnabled = FALSE;
  $entityType = $entity
    ->getEntityType();
  $bundleEntityType = $entityType
    ->getBundleEntityType();
  if ($bundleEntityType !== NULL) {
    $bundleType = $this->entityTypeManager
      ->getStorage($bundleEntityType)
      ->load($entity
      ->bundle());
    $moderationEnabled = $bundleType
      ->getThirdPartySetting('workbench_moderation', 'enabled', FALSE);
  }
  return $moderationEnabled;
}