I am trying to import from a csv that has multiple files in the same column, e.g.
title,gallery,tag
node1,img1.jpg|img2.jpg|img3.jpg,2
node2,img4.jpg,2
node3,img5.jpg|img6.jpg,3
I need to prepend the path to these file names to get something of the form /path/to/file/img4.jpg
.
I have written a process pipeline similar to the following (which doesn't work):
source:
constants:
file_source: '/import/images/'
file_destination: '/path/to/file/'
process:
title: title
field_gallery:
-
plugin: explode
source: gallery
delimiter: '|'
-
plugin: concat
source:
- constants/file_source
-
-
plugin: image_import
destination: constants/file_destination
The failure comes because the Concat plugin implodes the array containing a string and an array to give an output in the form /path/to/file/Array
.
I suspect there is a process plugin that I can insert between explode and concat that will solve this, but I can't work out what it is.
I have tried combinations of the plugins single_value
and multiple_values
from the Migrate Plus module, but that has not worked either.
For now I have written a custom process plugin to replace concat, but I would prefer a pipeline using pre-existing plugins.