Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $node = Node::create(['type' => 'my_contentType']);
- $node->set('title', $item['name']);
- $node->set('field_author_name', $item['author']);
- foreach ($FilePaths_keys as $path){
- $digitalFile_path = $item['bitstreams'][$path] ['retrieveLink'];
- $get_data_contents = file_get_contents($digitalFile_path);
- $file = file_save_data($get_data_contents, 'public://'.$item['bitstreams'][$path]['name'], FILE_EXISTS_REPLACE);
- $Dfiles = [
- 'target_id' => $file->id(),
- 'alt' => $item['bitstreams'][$path]['name'],
- 'title' => $item['bitstreams'][$path]['name']
- ];
- $node->set('field_book_image', $Dfiles);
- }
- $node->enforceIsNew();
- $node->save();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement