From c8bf9595cbfa7af32f7c69c6eec831262e9fde63 Mon Sep 17 00:00:00 2001
From: Benji Fisher <benji@FisherFam.org>
Date: Fri, 1 Jan 2021 16:10:29 -0500
Subject: [PATCH] 244: Add a second example to the documentation block

---
 src/Plugin/migrate/process/Transpose.php | 40 +++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/Plugin/migrate/process/Transpose.php b/src/Plugin/migrate/process/Transpose.php
index acd69532..445bb7c5 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"
  * )
-- 
GitLab