You are here

function hook_acquia_contenthub_cdf_alter in Acquia Content Hub 8

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

Modules may implement this hook to alter...

Parameters

\Acquia\ContentHubClient\Entity $contenthub_entity: The Acquia Content Hub entity.

array $context: Array consists out of at least 3 keys:

array['account'] object Defines the account it is being requested as.

array['entity'] Drupal\Core\Entity\ContentEntityInterface The entity that is being normalized.

array['langcode'] string The language the object was requested to be normalized in. Usually the normalization process iterates over all languages. Careful when making a selection based on this parameter.

See also

\Drupal\acquia_contenthub\Normalizer\ContentEntityNormalizer

1 invocation of hook_acquia_contenthub_cdf_alter()
ContentEntityCdfNormalizer::addFieldsToContentHubEntity in src/Normalizer/ContentEntityCdfNormalizer.php
Get fields from given entity.

File

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

Code

function hook_acquia_contenthub_cdf_alter(ContentHubEntity &$contenthub_entity, array &$context) {
  $langcode = isset($context['langcode']) ? $context['langcode'] : \Drupal::languageManager()
    ->getDefaultLanguage();
  $contenthub_entity
    ->setAttributeValue('my_attribute', 'this_is_my_value', $langcode);
}