You are here

public function FileSchemeIsSupported::onEnqueueCandidateEntity in Acquia Content Hub 8.2

Prevent files with unsupported schemes to be enqueued.

Parameters

\Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event: The event to determine entity eligibility.

Throws

\Exception

File

modules/acquia_contenthub_publisher/src/EventSubscriber/EnqueueEligibility/FileSchemeIsSupported.php, line 50

Class

FileSchemeIsSupported
Prevents enqueueing files whose scheme is not supported.

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility

Code

public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {

  // If this is a file with an unsupported scheme then do not export it.
  $entity = $event
    ->getEntity();
  if ($entity instanceof FileInterface && !$this->fileSchemeHandler
    ->isSupportedFileScheme($entity)) {
    $event
      ->setEligibility(FALSE);
    $event
      ->stopPropagation();
  }
}