You are here

public function IsNotParagraph::onEnqueueCandidateEntity in Acquia Content Hub 8.2

Prevent paragraphs 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/IsNotParagraph.php, line 32

Class

IsNotParagraph
Subscribes to entity eligibility to prevent enqueueing paragraphs.

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility

Code

public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {

  // Never export Paragraph entities as main entities.
  // They should only be exported as dependencies.
  $entity = $event
    ->getEntity();
  if ($entity instanceof ParagraphInterface) {
    $event
      ->setEligibility(FALSE);
    $event
      ->stopPropagation();
  }
}