You are here

private function Exporter::prepareToExport in Default Content Deploy 8

Prepare content to export.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to Exporter::prepareToExport()
Exporter::export in src/Exporter.php
Export entities by entity type, id or bundle.

File

src/Exporter.php, line 323

Class

Exporter
A service for handling export of default content.

Namespace

Drupal\default_content_deploy

Code

private function prepareToExport() {
  $entity_type = $this->entityTypeId;
  $exported_entity_ids = $this
    ->getEntityIdsForExport();
  if ($this->forceUpdate) {
    $this->fileSystem
      ->deleteRecursive($this
      ->getFolder());
  }
  foreach ($exported_entity_ids as $entity_id) {

    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $this->entityTypeManager
      ->getStorage($entity_type)
      ->load($entity_id);
    $exported_entity = $this
      ->getSerializedContent($entity);
    $this
      ->addExportedEntity($exported_entity);
  }
}