public function ManageExport::import in Content Export YAML 8
File
- src/
ManageExport.php, line 83
Class
Namespace
Drupal\content_export_yamlCode
public function import($id, $entity, $bundle, $options = []) {
$path = isset($options['path']) ? $options['path'] : null;
$yaml = $this->func
->load_entity_config_list_with_path($entity, $bundle, [
$id,
], $path);
$parsed = new Parser();
$object = $parsed
->parse($yaml[$id], SymfonyYaml::PARSE_OBJECT);
if (is_object($object)) {
return $this->func
->savingEntity($object, $entity);
}
\Drupal::messenger()
->addMessage(t('Failed to save item'), 'error');
return false;
}