public function ContentSyncManager::generateImportQueue in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/ContentSyncManager.php \Drupal\content_sync\ContentSyncManager::generateImportQueue()
Parameters
$file_names:
$directory:
Return value
array
File
- src/
ContentSyncManager.php, line 67
Class
Namespace
Drupal\content_syncCode
public function generateImportQueue($file_names, $directory) {
$queue = [];
foreach ($file_names as $file) {
$ids = explode('.', $file);
list($entity_type_id, $bundle, $uuid) = $ids;
$file_path = $directory . "/" . $entity_type_id . "/" . $bundle . "/" . $file . ".yml";
if (!file_exists($file_path) || !$this
->isValidFilename($file)) {
continue;
}
$content = file_get_contents($file_path);
$format = $this->contentImporter
->getFormat();
$decoded_entity = $this->serializer
->decode($content, $format);
$decoded_entities[$file] = $decoded_entity;
}
if (!empty($decoded_entities)) {
$resolver = new ImportQueueResolver();
$queue = $resolver
->resolve($decoded_entities);
}
return $queue;
}