You are here

class IsNotContentModerationState in Acquia Content Hub 8.2

Subscribes to entity eligibility to prevent enqueueing temporary files.

Hierarchy

  • class \Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\IsNotContentModerationState implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of IsNotContentModerationState

1 string reference to 'IsNotContentModerationState'
acquia_contenthub_publisher.services.yml in modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
1 service uses IsNotContentModerationState
content_moderation_state.enqueue in modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\IsNotContentModerationState

File

modules/acquia_contenthub_publisher/src/EventSubscriber/EnqueueEligibility/IsNotContentModerationState.php, line 13

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility
View source
class IsNotContentModerationState implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[ContentHubPublisherEvents::ENQUEUE_CANDIDATE_ENTITY][] = [
      'onEnqueueCandidateEntity',
      50,
    ];
    return $events;
  }

  /**
   * Prevent temporary files from enqueueing.
   *
   * @param \Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event
   *   The event to determine entity eligibility.
   *
   * @throws \Exception
   */
  public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {

    // Never export ContentModerationState entities.
    $entity = $event
      ->getEntity();
    if ($entity instanceof ContentModerationState) {
      $event
        ->setEligibility(FALSE);
      $event
        ->stopPropagation();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
IsNotContentModerationState::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
IsNotContentModerationState::onEnqueueCandidateEntity public function Prevent temporary files from enqueueing.