You are here

protected function EntityCdfSerializer::preprocessCdf in Acquia Content Hub 8.2

Dispatches events to prune and tamper data from incoming CDF document.

Parameters

\Acquia\ContentHubClient\CDFDocument $cdf: The CDF document.

\Drupal\depcalc\DependencyStack $stack: The dependency stack.

Return value

\Acquia\ContentHubClient\CDFDocument The preprocessed CDF document.

1 call to EntityCdfSerializer::preprocessCdf()
EntityCdfSerializer::unserializeEntities in src/EntityCdfSerializer.php
Unserializes a CDF into a list of Drupal entities.

File

src/EntityCdfSerializer.php, line 305

Class

EntityCdfSerializer
Serialize an entity to a CDF format.

Namespace

Drupal\acquia_contenthub

Code

protected function preprocessCdf(CDFDocument $cdf, DependencyStack $stack) : CDFDocument {
  $prune_cdf_event = new PruneCdfEntitiesEvent($cdf);
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::PRUNE_CDF, $prune_cdf_event);
  $cdf = $prune_cdf_event
    ->getCdf();

  // Allows entity data to be manipulated before unserialization.
  $entity_data_tamper_event = new EntityDataTamperEvent($cdf, $stack);
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::ENTITY_DATA_TAMPER, $entity_data_tamper_event);
  return $entity_data_tamper_event
    ->getCdf();
}