Score:-2

how to import 3 xml selectors in one drupal field using the migrate plus module?

za flag

the migrate_plus migration conf i had so far was

process:     
  title: title
  body: job_description
  field_job_diffusion: offer_type
  field_job_statut: statut
  field_job_domaine: domaine
  field_job_campus: campus
  field_job_niveau_etudes: study_level
  field_job_emailapi: application_email

It works for single XML selector to single field mapping and migration. I need now to get the value from 3 xml selectors and put them in one multivalued field.

How can i achieve this?

Matoeil avatar
za flag
i feel sorry it is down-voted as it is less than obvious to find the doc on how to use these migration yml files and now thanks to @Joseph it cleared up my mind
Score:1
in flag

The docs has a list of process plugins from core and migrate plus you can use to manipulate the data before they get set on the field.

get is the plugin used by Drupal when you use the shorthand mapping syntax (i.e. how you're doing it right now). However, you can write the longhand version, it also accepts an array as source, which it will then treat as a multi-value source. Simply pop an array of the source field names into an array as the source:

process:
  field_phone_numbers:
    -
      plugin: get
      source:
        - main_number
        - mobile_number
        - office_number
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.