In working on a project where we were migrating a Drupal 7 site to Drupal 8, I came across a case where we needed to migrate the data from what was a regular text field in the Drupal 7 site into a link field in the new Drupal 8 site. As it was, the YAML for the migration was treating the destination field as a text field as well:
field_lab_website:
plugin: get
source: field_lab_website
This meant that the data didn't get migrated into the new site at all. I did some Googling, but wasn't able to find anything helpful. So, I looked at some of the other migration YAML files, saw some some cases where the "sub_process" plugin was getting used, and tried that out. What worked was this:
field_lab_website:
plugin: sub_process
source: field_lab_website
process:
uri: value
This works because the Drupal 8 link field is a multi-value field. By using the "sub_process" plugin, we can tell Drupal what to use for each component of the field.
5 Comments
It worked for me to ...really helpful post
Thank you. Just I was looking for.
Thank you, It worked for me.
And just in case this is the first search result, as it was for me, I have a migration that is D7 link to D8 link. It seems that 8.4.x migrate API changed, and you must now do:
Thanks for this, but this appears to be for a different use case than my original post. In my case, I was migrating from a URL stored in a text field in the D7 site to a link field in the D8 site. This looks like you're migrating from a link field to a link field.
I believe the code in the original post is still correct.