public function ManageExport::importFrom in Content Export YAML 8
Import all entity
4 calls to ManageExport::importFrom()
File
- src/
ManageExport.php, line 114
Class
Namespace
Drupal\content_export_yamlCode
public function importFrom($entity, $bundle, array $range, $options) {
$path = isset($options['path']) ? $options['path'] : null;
$yamls = $this->func
->load_entity_config_list_with_path($entity, $bundle, $range, $path);
$parsed = new Parser();
$status_list = [];
foreach ($yamls as $content) {
$object = $parsed
->parse($content, SymfonyYaml::PARSE_OBJECT);
if (is_object($object)) {
$status = $this->func
->savingEntity($object, $entity);
if ($status != 1 || $status != 2) {
\Drupal::messenger()
->addMessage(t('Failed to save item'), 'error');
}
$status_list[] = [
'status' => $status,
'label' => $object
->label(),
'file_name' => $object
->id(),
];
}
else {
\Drupal::messenger()
->addMessage(t('Failed to convert yaml to object'), 'error');
}
}
return $status_list;
}