Content Hub

Eligibile and ineligible entities



Related Products

Before adding entities to the export queue, Content Hub checks the eligibility of an entity, and dispatches the ContentHubPublisherEvents::ENQUEUE_CANDIDATE_ENTITY event. The subscribers of this event decide an entity's eligibility, and log the reason if it is ineligible to be enqueued to the export queue. You can export an ineligible entity as a dependency.

The following event subscribers that are enabled by default mark entities as ineligible based on the criteria:

Event subscriberDescription
EntityTypeOrBundleExcludeMarks selected entity types and bundles as ineligible for the export process. By using the ExcludeSettingsForm form, you can select entity types and bundles that you want to exclude from the export process. For more information about excluding entity types and bundles, see Excluding entities from export.
ExcludeConfigEntitiesMarks all config entities as ineligible. This prevents the system from enqueuing config entities. This occurs when the setting to exclude config entities from export is enabled in a module. For more information about excluding config entities, see Syndicating configuration with Content Hub.
FileIsTemporaryDoes not enqueue temporary files.
FileSchemeIsSupported

Prevents enqueueing files with unsupported schemes.

The supported schemes are:

  • empty (without a scheme)
  • http://
  • https://
  • private://
  • public://
ImportedEntityMarks previously imported entities as ineligible. This is applicable for sites that are publisher and subscriber.
IsAlreadyEnqueuedPrevents an entity that is already in the export queue.
IsNotContentModerationStatePrevents the export of ContentModerationState entities.
IsNotParagraphDoes not enqueue paragraphs.
IsPathAliasForUnpublishedContentDoes not enqueue path aliases of unpublished content.
MissingIdDoes not enqueue entity with missing ID.
MissingUuidDoes not enqueue entity with missing UUID.
RevisionIsCurrentPrevents the system from enqueueing unpublished revisions of the entity.

Customizing ineligible entity list

You can create custom event subscribers that subscribe to the ​​ContentHubPublisherEvents ::ENQUEUE_CANDIDATE_ENTITY event. Acquia recommends that you set the eligibility of the entity inside such subscribers to false. For example, ContentHubEntityEligibilityEvent::setEligibility(FALSE). You can also provide your reason so that the system logs that information. For example, ContentHubEntityEligibilityEvent::setReason('Reason for marking entity ineligible');.

Sample custom event subscriber:

<?php

namespace Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility;

use Drupal\acquia_contenthub_publisher\ContentHubPublisherEvents;
use Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent;
use Drupal\Component\Uuid\Uuid;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Any entity that is missing its UUID shouldn't be enqueued.
 *
 * @package Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility
 */
class MissingUuid implements EventSubscriberInterface {

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

    return $events;
  }

  /**
   * Skips entities missing its UUID.
   *
   * @param \Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event
   *   The event to determine entity eligibility.
   *
   * @throws \Exception
   */
  public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {
    $entity = $event->getEntity();

    if (!Uuid::isValid($entity->uuid())) {
      $event->setEligibility(FALSE);
      $event->setReason('Missing entity uuid.');
      $event->stopPropagation();
    }
  }

}

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.