If a subscribing website in your Content Hub subscription contains entities with a different data structure than your publishing website, you may need to customize your shared content as it moves in and out of your publishing website. Content Hub includes hooks that allow you to customize shared content before publication on a subscribing website, or to strip out customizations before submitting content back to the publishing website.
You can use the available hooks to improve content syndication by modifying either your website’s Common Data Format (CDF) or your entity’s data structure to match your subscribing or publishing website’s individual needs.
Modifying the Common Data Format (CDF)
Select from the following hooks, based on your installed Drupal version, to modify your website’s CDF in these methods:
- Modify the CDF before it is sent to the publishing website during the normalization process This hook’s changes affect the publishing website’s entity, but the subscribing website’s Drupal entity will remain unchanged.
- Current Drupal version:
hook_acquia_contenthub_cdf_from_drupal_alter
- Drupal 7:
hook_content_hub_connector_cdf_from_drupal_alter
- Current Drupal version:
- Modify the CDF fetched from the publishing website before being converted to a Drupal entity during the de-normalization process This hook’s changes affect the subscribing website’s entity, but the publishing website’s entity will remain unchanged.
- Current Drupal version:
hook_acquia_contenthub_cdf_from_hub_alter
- Drupal 7:
hook_content_hub_connector_cdf_from_hub_alter
- Current Drupal version:
Modifying the Drupal entity
Select from the following hooks, based on your installed Drupal version, to modify your entity’s data structure in these available methods:
- Modify the Drupal entity after its conversion from the CDF that is fetched from the publishing website during the de-normalization process This hook’s changes affect the subscribing website’s entity imported from the publishing website, but the publishing website’s entity will remain unchanged.
- Current Drupal version:
hook_acquia_contenthub_drupal_from_cdf_alter
- Drupal 7:
hook_content_hub_connector_drupal_from_cdf_alter
- Current Drupal version:
- Add fields to the Drupal entity before it is converted to a CDF during the export process This hook’s changes affect the publishing website’s entity, but the subscribing website’s Drupal entity will remain unchanged.
- Current Drupal version:
hook_acquia_contenthub_drupal_to_cdf_alter
- Drupal 7:
hook_content_hub_connector_drupal_to_cdf_alter
- Current Drupal version:
Examples
Code examples for these hooks can be found in the module’s API file, depending on the version of Drupal in use:
Current Drupal version: acquia_contenthub.api.php
This file is applicable only for Content Hub 8.x-1.x. For Content Hub 8.x-2.x, see Understanding Content Hub events.