Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was looking for a way to replace multiple values while importing, and from the documentation I wasn't sure if it was possible with the String Replace Process plugin, but this seems to work:
field_country:
plugin: str_replace
source: text
search: ["AT", "CH", "DK"]
replace: ["Austria", "Switzerland", "Denmark"]
Here is a patch which adds a bit about how to import multiple values to https://cgit.drupalcode.org/migrate_plus/tree/src/Plugin/migrate/process....
Comment | File | Size | Author |
---|---|---|---|
#2 | string_replace_multiple_example-3010390-2.patch | 702 bytes | ressa |
Comments
Comment #2
ressa CreditAttribution: ressa at Ardea commentedHere's the patch.
Comment #3
heddnI like it. Thanks for your improvements here.
Comment #5
heddnComment #6
ressa CreditAttribution: ressa at Ardea commentedThanks for reviewing and approving, and all the good work you do on the Migrate modules.