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....

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ressa created an issue. See original summary.

ressa’s picture

Status: Active » Needs review
FileSize
702 bytes

Here's the patch.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

I like it. Thanks for your improvements here.

  • heddn committed b3a8843 on 8.x-4.x authored by ressa
    Issue #3010390 by ressa, heddn: Multiple values with String Replace...
heddn’s picture

Status: Reviewed & tested by the community » Fixed
ressa’s picture

Thanks for reviewing and approving, and all the good work you do on the Migrate modules.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.