Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

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

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.4 Stable Oct 28, 2024