How can I import fields into Drupal 8.4 user profile from a csv file that has identical values in the key row?

I’m using Migrate Tools, Migrate Plus and Migrate Source CSV. My CSV file looks like that:

"Stg";"Color";"Fruit" "user1";"red";"apple" "user1";"blue";"pear" "user2";"green";"banana" "user2";"black";"rotten banana" 

I’m using the Profile Module (https://www.drupal.org/project/profile)

I have a migration within my migration group that looks like this (migrate_plus.migration.user_vorlesungen.yml):

id: user_vorlesungen langcode: de status: true dependencies:     enforced:         module:             - user_migrate migration_group: hoevwa label: 'HoeVWA Vorlesungen Import' source:     plugin: csv     track_changes: true     path: /config/Vorlesungsverzeichnis.csv     # Column delimiter. Comma (,) by default.     delimiter: ';'     # Field enclosure. Double quotation marks (") by default.     enclosure: '"'     header_row_count: 1     keys:         - Stg destination:     plugin: entity:profile process:     type:         plugin: default_value         default_value: 'vorlesungen'     uid:         plugin: migration_lookup         no_stub: true         # previous user migration         migration: user__hoerer         # property in the source data         source: Stg     # These field have multiple values in D8     field_color: Color     field_fruit: Fruit  migration_dependencies:     required: {  }     optional: {  } 

In my YAML file the content is printed like that:

... <table>   <tr>     <td>{{ content.field_color }}</td>     <td>{{ content.field_fruit }}</td>   </tr> </table> ... 

When I run drush mim –group=hoevwa only the last values of user1 (blue, pear) are imported. How can I get running a process plugin to loop through the CSV and get all values imported. And finally how can I loop through all values in my TWIG Template?

Sponsored by SupremePR
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

How can I import fields into Drupal 8.4 user profile from a csv file that has identical values in the key row?

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.