Information for: DEVELOPERS   PARTNERS

Excluding data from the export process

You can limit the export of particular types of data when syndicating information. Content Hub has two mechanisms to prevent data from syndicating to the Content Hub service: preventing queueing, which is relatively straightforward, and preventing entity syndication, which can be more complex.

Preventing queuing

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.

To alter this 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 example, Content Hub should not attempt to syndicate temporary files. To prevent this behavior, Content Hub uses a class which prevents creation of new files from triggering the enqueue process. For an example of a class that prevents temporary files from being queued, download the following file: enqueue-entity-eligibility.php.

Preventing entity syndication

It may not be enough to only prevent data from being queued. The dependency calculation process will match to any identified entity during processing. The additional identified entities may still be added to the queue process and passed to the Content Hub service, due to their calculated relationship to the data you want to export.

For example, when exporting information, we don’t want to export unchanged data after it has already been exported. To prevent multiple exports of data that has not changed, Content Hub creates a hash of entity values, and then compares the entity hash values during the export process. If Content Hub encounters a hash value for a previously exported entity, it will not be exported again. More complex requests may require additional checking.

Dependency tracking can be difficult and can cause several issues. If you need to remove a particular type of entity, be sure to remove any unnecessary dependencies that have been calculated to match that entity. Leaving these dependencies in place may cause unexpected patterns of data communication with no obvious connection between the entities that are syndicated.

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