You are here

protected function EntityCdfSerializer::dispatchImportEvent in Acquia Content Hub 8.2

Dispatches entity import event.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being imported.

\Acquia\ContentHubClient\CDF\CDFObject $entity_data: The CDF object.

1 call to EntityCdfSerializer::dispatchImportEvent()
EntityCdfSerializer::processCdf in src/EntityCdfSerializer.php
Processes incoming CDF.

File

src/EntityCdfSerializer.php, line 386

Class

EntityCdfSerializer
Serialize an entity to a CDF format.

Namespace

Drupal\acquia_contenthub

Code

protected function dispatchImportEvent(EntityInterface $entity, CDFObject $entity_data) {
  if ($entity
    ->isNew()) {
    $event_name = AcquiaContentHubEvents::ENTITY_IMPORT_NEW;
    $entity_import_event = new EntityImportEvent($entity, $entity_data);
  }
  else {
    $event_name = AcquiaContentHubEvents::ENTITY_IMPORT_UPDATE;
    $entity_import_event = new EntityImportEvent($entity, $entity_data);
  }
  $this->dispatcher
    ->dispatch($event_name, $entity_import_event);
}