You are here

function hook_acquia_contenthub_exclude_fields_alter in Acquia Content Hub 8

Alter the excluded field types and names that get converted into a CDF.

Common Data Format (CDF): https://docs.acquia.com/content-hub/cdf.

Modules may implement this hook to alter the fields that get excluded from being converted into a Content Hub CDF object. For example the status, sticky and promote flags are excluded because they define the state of a piece of content and not the piece of content itself. Acquia Content Hub's main responsibility is transferring content, not the state of it.

Parameters

array $excluded_fields: The Field types that are excluded from being normalized into a CDF document.

See also

\Drupal\acquia_contenthub\Normalizer\ContentEntityNormalizer

1 invocation of hook_acquia_contenthub_exclude_fields_alter()
ContentEntityCdfNormalizer::excludedProperties in src/Normalizer/ContentEntityCdfNormalizer.php
Provides a list of entity properties that will be excluded from the CDF.

File

./acquia_contenthub.api.php, line 190
Hooks provided by the Acquia Content Hub module.

Code

function hook_acquia_contenthub_exclude_fields_alter(array &$excluded_fields, ContentEntityInterface $entity) {

  // Do not include the uuid field.
  $excluded_fields[] = 'uuid';

  // Gets a specific entity key and add it to the excluded fields array.
  $excluded_fields[] = $entity
    ->getEntityType()
    ->getKey('id');
}