Fill multi-value field from comma separated values in a field

I have data in xml which I want to import into drupal. Which works fine. But one field in the xml is filled with a comma separated list of terms. There is a target field in drupal which is a multi-valued field. I do not need those as a taxonomy, just as multi-value for solr search. I just want to expand the one,fourty,flower,... values to fill the multiple-value field.

It absolutely will not work. Any help?

Here is the latest iteration (I tried a lot in the last two days) which fails spectacularly with an error like so:

Error: Unsupported operand types in /var/www/dev.diercke.com/web/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php on line 206 #0 /var/www/dev.diercke.com/web/core/modules/migrate/src/MigrateExecutable.php(399): DrupalmigratePluginmigrateprocessSubProcess->transform(Array, Object(Drupalmigrate_toolsMigrateExecutable), Object(DrupalmigrateRow), 'field_stichwort...')
#1 /var/www/dev.diercke.com/web/core/modules/migrate/src/MigrateExecutable.php(205): DrupalmigrateMigrateExecutable->processRow(Object(DrupalmigrateRow))
#2 /var/www/dev.diercke.com/vendor/drush/drush/includes/drush.inc(206): DrupalmigrateMigrateExecutable->import()
#3 /var/www/dev.diercke.com/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)
#4 /var/www/dev.diercke.com/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(958): drush_op(Array)
#5 [internal function]: Drupalmigrate_toolsCommandsMigrateToolsCommands->executeMigration(Object(DrupalmigratePluginMigration), 'karte', Array)
#6 /var/www/dev.diercke.com/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(418): array_walk(Array, Array, Array)
#7 [internal function]: Drupalmigrate_toolsCommandsMigrateToolsCommands->import('karte', Array)
#8 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#9 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): ConsolidationAnnotatedCommandCommandProcessor->runCommandCallback(Array, Object(ConsolidationAnnotatedCommandCommandData))
#10 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): ConsolidationAnnotatedCommandCommandProcessor->validateRunAndAlter(Array, Array, Object(ConsolidationAnnotatedCommandCommandData))
#11 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): ConsolidationAnnotatedCommandCommandProcessor->process(Object(SymfonyComponentConsoleOutputConsoleOutput), Array, Array, Object(ConsolidationAnnotatedCommandCommandData))
#12 /var/www/dev.diercke.com/vendor/symfony/console/Command/Command.php(255): ConsolidationAnnotatedCommandAnnotatedCommand->execute(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#13 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(1027): SymfonyComponentConsoleCommandCommand->run(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#14 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(273): SymfonyComponentConsoleApplication->doRunCommand(Object(ConsolidationAnnotatedCommandAnnotatedCommand), Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#15 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(149): SymfonyComponentConsoleApplication->doRun(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#16 /var/www/dev.diercke.com/vendor/drush/drush/src/Runtime/Runtime.php(118): SymfonyComponentConsoleApplication->run(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#17 /var/www/dev.diercke.com/vendor/drush/drush/src/Runtime/Runtime.php(48): DrushRuntimeRuntime->doRun(Array, Object(SymfonyComponentConsoleOutputConsoleOutput))
#18 /var/www/dev.diercke.com/vendor/drush/drush/drush.php(72): DrushRuntimeRuntime->run(Array)
#19 /var/www/dev.diercke.com/vendor/drush/drush/drush(4): require('/var/www/dev.di...')
#20 {main}
Error: Unsupported operand types in DrupalmigratePluginmigrateprocessSubProcess->transform() (line 206 of /var/www/dev.diercke.com/web/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php).
 [warning] Drush command terminated abnormally.
...
process:
...
  field_stichworte: tags
  field_stichworte_einzeln:
    - plugin: explode
      source: tags
      limit: 10000
      delimiter: ,
    - plugin: deepen
    - plugin: sub_process
      process:
        field_stichworte_einzeln:
          - plugin: extract
            index:
              - 0
...
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

Fill multi-value field from comma separated values in a field

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.