diff --git a/src/Plugin/migrate/process/Transpose.php b/src/Plugin/migrate/process/Transpose.php index acd6953228e2f0c8626bf98907d8769fe91ef263..445bb7c515519a5ea638cf12aaf0fb1f04d81c4b 100644 --- a/src/Plugin/migrate/process/Transpose.php +++ b/src/Plugin/migrate/process/Transpose.php @@ -9,7 +9,7 @@ use Drupal\migrate\ProcessPluginBase; /** * Exchange rows and columns. * - * Example: + * Examples: * * @code * process: @@ -25,6 +25,44 @@ use Drupal\migrate\ProcessPluginBase; * This will create an array of 3-element, numerically indexed arrays. Each * array will have one element from each of the source properties. * + * @code + * process: + * field_link: + * - + * plugin: transpose + * source: + * - link_url + * - link_text + * - + * plugin: sub_process + * process: + * uri: + * - + * plugin: extract + * source: + * - 0 + * index: + * - 0 + * - + * plugin: link_uri + * validate_route: false + * title: + * - + * plugin: extract + * source: + * - 1 + * index: + * - 0 + * @endcode + * + * Suppose the source property link_url has the URL for three links, and the + * source property link_text has the corresponding link text: + * [url0, url1, url2] and [text0, text1, text2]. + * Then the transpose plugin produces + * [[url0, text0], [url1, text1], [url2, text2]]. + * Inside sub_process, the extract plugin in this example takes each + * [url, text] subarray and assigns uri: url, title: text. + * * @MigrateProcessPlugin( * id = "transpose" * )