This project is not covered by Drupal’s security advisory policy.

This plugin converts an indexed array of flat values to an indexed array of single-element associative arrays.
That is, each flat value of the original array becomes a new associative array, whose key is defined in the plugin configuration and whose value is the original array's value of that position.
See the example below.

Possible use case: If you have to migrate a multivalue field and pipe it to another process plugin that cannot handle multiple values, you'll need to somehow iterate through the array of values and pipe each one of them to that plugin.
The sub_process plugin that is provided by core can only work on an array of associative arrays. So if your source is something like:

some_source: Array
  (
    [0] => "one"
    [1] => "two"
  )

then you cannot use sub_process.

This plugin will convert this array to an associative one, with a key that you define in its configuration:

    field_my_field:
      plugin: make_array_associative
      key: my_temp_key
      source: some_source

Then your value will be converted to:

some_source: Array
  (
    [0] => ["my_temp_key" => "one"]
    [1] => ["my_temp_key" => "two"]
  )

which means that you can now pipe it to the sub_process plugin:

  field_my_field:
    - plugin: make_array_associative
      key: my_temp_key
      source: some_source
    - plugin: sub_process
      process:
        final_key:
          plugin: some_plugin_that_cannot_handle_multiple_values
          source: my_temp_key
Supporting organizations: 
Initial module development and maintenance

Project information

Releases