0

I'm having some issues with storing multiple taxonomy terms in a field as part of a migration.

I've created a custom plugin get_colors that returns an array of existing tids. A custom process plugin was needed her as the source values don't map cleanly.

pseudofield_colors:
    plugin: get_colors
    source: keywords

I can get a single tid value to work correctly but can't figure out how to iterate through this array and assign multiple values.

field_color:
    plugin: sub_process
      source: '@pseudofield_colors'
      process:
        target_id:
          plugin: entity_lookup
          source: target_id
          entity_type: taxonomy_term
          bundle: my_colors
          bundle_key: vid
          value_key: target_id

I'm lost in two ways:

  1. What format should my return array be in? Should it just be an array of tids ["0" => "123", "1" => "567"] or does it need to have specific keys?
  2. I found a lot of documentation on using sub_process and entity_lookup. Is entity_lookup necessary here? Returning a single tid works so I'd assume I could somehow iterate through my array and just assign multiple values but this is where I'm getting really stuck.

Thanks for the help!

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.