You are here

public function LingotekWorkbenchModerationHandler::shouldModerationPreventUpload in Lingotek Translation 4.0.x

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

Checks if we should prevent upload based on content moderation settings.

Parameters

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

Return value

bool Returns TRUE if we should prevent the upload based on content moderation.

Overrides LingotekModerationHandlerInterface::shouldModerationPreventUpload

File

src/Moderation/LingotekWorkbenchModerationHandler.php, line 67

Class

LingotekWorkbenchModerationHandler
Workbench moderation handler managing the Lingotek integration.

Namespace

Drupal\lingotek\Moderation

Code

public function shouldModerationPreventUpload(EntityInterface $entity) {
  $prevent = FALSE;
  if ($this->moduleHandler
    ->moduleExists('workbench_moderation')) {
    $moderationEnabled = $this
      ->isModerationEnabled($entity);
    if ($moderationEnabled) {
      $uploadStatus = $this->moderationConfiguration
        ->getUploadStatus($entity
        ->getEntityTypeId(), $entity
        ->bundle());
      $state = $this
        ->getModerationState($entity);
      if ($state !== $uploadStatus) {
        $prevent = TRUE;
      }
    }
  }
  return $prevent;
}