Content Hub

Excluding entities from export

Important

Content Hub 2.x will reach end-of-life on December 31, 2024. Acquia recommends that you update your Content Hub version to Content Hub 3.x by using the composer require instructions available on the acquia_contenthub project page.

Content Hub adds items to the queue after saving or updating any entity, including changes to layout items such as views, blocks, or menus. Adding new fields, rearranging how fields display in entity_view_display entities, or nearly any other action which could touch content or configuration entities will trigger Content Hub, which is a generally desired behavior.

Content Hub has the following mechanisms to control the content being exported:

  • Preventing queueing: Queueing allows you to place items in a queue for processing later. However, Content Hub can prevent queueing, which is a simple process.
  • Preventing entity syndication: Syndication allows you to leverage content created on one site to other sites in your fleet. This is a complex process.

Excluding entity types or bundles from the export queue

On the publisher website, you can select entity types or bundles that you want to exclude from the export queue. For example, the system excludes nodes for Basic pages. When creating or updating this type of node on the publisher, the system does not add it to the export queue automatically.

Note

Excluding entity types or bundles from the export queue does not control entities that are dependencies of other entities. All dependencies are exported regardless of the configuration of this form.

To exclude by entity type or bundle or both, navigate to Administration > Configuration > Web services > Acquia Content Hub. Click the Exclude from export queue tab, to use the provided multi-select fields:

Preventing queuing with custom code

To alter the default queuing behavior, use the following event:

\Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent

Event subscribers listening to the following endpoint provide examples of how to exclude certain kinds of data:

\Drupal\acquia_contenthub_publisher\AcquiaContentHubPublisherEvents::ENQUEUE_CANDIDATE_ENTITY

For an example of a class that prevents items from being enqueued, download the following file: enqueue-entity-eligibility.php. This class prevents temporary files from entering the export queue.

Preventing entity syndication with custom code

Preventing data from being queued may not suffice. The dependency calculation process can match any identified entity during processing. Additional identified entities might still join the queue process and pass to the Content Hub service due to their calculated relationship with the data intended for export.

Consider an export scenario. The goal is not to export unchanged data after its initial export. To avoid multiple exports of unchanged data, Content Hub generates a hash of entity values and compares these hash values during the export process. If Content Hub finds a hash value for an entity already exported, it does not export it again. More intricate requests might necessitate further checks.

Dependency tracking can pose challenges and lead to various issues. If there is a need to eliminate a specific type of entity, ensure the removal of any unnecessary dependencies calculated to match that entity. Retaining these dependencies might result in unexpected data communication patterns with no clear link between the syndicated entities.

For an example of a class that removes unmodified entities before publication, download the following file: content-hub-publish-entities.php content-hub-publish-entities.php