Add variants of process plugins with handle_multiples set to false

Created on 12 June 2024, 6 months ago
Updated 26 June 2024, 5 months ago

Problem/Motivation

I've never been totally happy with the decision to have all process plugins provided by Migrate Conditions "handle_multiples". I'm confident that it makes the most common use cases as easy as possible, without ever having to reach for the single_value plugin. However, setting "handle_multiples" to true prevents us from iterating through a source array, even with the help of the multiple_values plugin (which becomes useless).

Proposed resolution

Use hook_migrate_process_info_alter() to create variants of all our process plugins that set handle_multiples to FALSE. The new variants will be suffixed with :foreach.

User interface changes

nope

API changes

New process plugins like evaluate_condition:foreach and if_condition:foreach.

Data model changes

nope

✨ Feature request
Status

Fixed

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @danflanagan8
  • Status changed to Fixed 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    Hurray!

    Here's the comment for the info alter, the example being identical to what is covered in the test.

    /**
     * Create :foreach process plugin variants that do not handle multiples.
     *
     * For example, if the my_array is an array [4, 2]...
     *
     * @code
     * my_dest:
     *   plugin: evaluate_condition
     *   condition: greater_than(3)
     *   source: my_array
     * @endcode
     *
     * will result in my_dest being TRUE since any array is greater than 3.
     *
     * However...
     *
     * @code
     * my_dest:
     *   plugin: evaluate_condition:foreach
     *   condition: greater_than(3)
     *   source: my_array
     * @endcode
     *
     * will result in my_dest being [TRUE, FALSE] since 4 is greater than 3 while
     * 2 is less than three.
     *
     * Implements hook_migrate_process_info_alter().
     */
    
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024