I'm trying to migrate a node bundle from one drupal 9 application to another.
My source format is an XML document.
I'm stuck migrating a multi-value link field.
Both the source and destination machine names are field_quicklinks.
The source value is a string with two delimiters like the following.
"https://www.somedomain.org/somewhere/something.pdf*Something Document^https://www.someotherdomain.org/somewhere-else/some-other-document.pdf*Some Other Document^https://www.yetsomeotherdomain.org/yet-somewhere-else/yet-another-document.pdf*Yet Another Document"
So my intent is to explode this twice to look like:
[
[
"https://www.somedomain.org/somewhere/something.pdf",
"Something Document"
],
[
"https://www.someotherdomain.org/somewhere-else/some-other-document.pdf",
"Some Other Document"
],
[
"https://www.yetsomeotherdomain.org/yet-somewhere-else/yet-another-document.pdf",
"Yet Another Document"
]
]
The latest iteration of my attmpts looks like:
field_quicklinks:
-
plugin: skip_on_value
method: process
value: FIELD_EMPTY
source: field_quicklinks
-
plugin: explode
source: field_quicklinks
delimiter: '^'
-
plugin: multiple_values
source: field_quicklinks
-
plugin: explode
source: field_quicklinks
delimiter: '*'
-
plugin: sub_process
source: field_quicklinks
process:
field_quicklinks/uri:
plugin: callback
source: field_quicklinks
callable: array_shift
-
plugin: sub_process
source: field_quicklinks
process:
field_quicklinks/title:
plugin: callback
source: field_quicklinks
callable: array_pop
If somebody could get me on track I would of course appreciate it very much.