private function Exporter::prepareToExportAllContent in Default Content Deploy 8
Prepare all content on the site to export.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 call to Exporter::prepareToExportAllContent()
- Exporter::export in src/
Exporter.php - Export entities by entity type, id or bundle.
File
- src/
Exporter.php, line 367
Class
- Exporter
- A service for handling export of default content.
Namespace
Drupal\default_content_deployCode
private function prepareToExportAllContent() {
$content_entity_types = $this->deployManager
->getContentEntityTypes();
if ($this->forceUpdate) {
$this->fileSystem
->deleteRecursive($this
->getFolder());
}
foreach ($content_entity_types as $entity_type => $label) {
// Skip specified entities in --skip_entity_type option.
if (!$this->skipEntityIds || !in_array($entity_type, $this->skipEntityIds)) {
$this
->setEntityTypeId($entity_type);
$query = $this->entityTypeManager
->getStorage($entity_type)
->getQuery();
$entity_ids = array_values($query
->execute());
foreach ($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);
}
}
}
}