public function FileIsTemporary::onEnqueueCandidateEntity in Acquia Content Hub 8.2
Prevent temporary files from enqueueing.
Parameters
\Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event: The event to determine entity eligibility.
Throws
\Exception
File
- modules/
acquia_contenthub_publisher/ src/ EventSubscriber/ EnqueueEligibility/ FileIsTemporary.php, line 32
Class
- FileIsTemporary
- Subscribes to entity eligibility to prevent enqueueing temporary files.
Namespace
Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibilityCode
public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {
// If this is a file with status = 0 (TEMPORARY FILE) do not export it.
// This is a check to avoid exporting temporary files.
$entity = $event
->getEntity();
if ($entity instanceof FileInterface && $entity
->isTemporary()) {
$event
->setEligibility(FALSE);
$event
->stopPropagation();
}
}