diff --git a/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php b/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php index 481196d..cb11fc6 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php +++ b/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php @@ -7,7 +7,7 @@ use Drupal\migrate\Row; /** - * Processes associative array value of a row through its own process pipeline. + * Runs an array of arrays through its own process pipeline. * * The sub_process plugin accepts an array of associative arrays and runs each * one through its own process pipeline, producing a newly keyed associative @@ -15,7 +15,8 @@ * * Available configuration keys: * - process: the plugin(s) that will process each element of the source. - * - key: runs the process pipeline for the key to determine its dynamic name. + * - key: runs the process pipeline for the key to determine a new dynamic + * name. * * Examples: * @@ -63,6 +64,48 @@ * destination value from a previous migration. The display and description * fields will simply be mapped. * + * In the next example, normally the array returned from sub_process will have + * its original keys. If you need to change the key, it is possible for the + * returned array to be keyed by one of the transformed values in the sub-array. + * + * @code + * source: Array + * ( + * [format] => 1 + * [name] => Filtered HTML + * ... + * [filters] => Array + * ( + * [0] => Array + * ( + * [module] => filter + * [delta] => 2 + * [weight] => 0 + * ) + * [1] => Array + * ( + * [module] => filter + * [delta] => 0 + * [weight] => 1 + * ) + * ) + * ) + * ... + * + * process: + * filters: + * plugin: iterator + * source: filters + * key: "@id" + * process: + * id: + * plugin: static_map + * bypass: true + * map: + * filter: + * ... + * @endcode + * * @see \Drupal\migrate\Plugin\MigrateProcessInterface * * @MigrateProcessPlugin(