From 91baefec2d58d23e579d40cbdab8354c88bf6431 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Tue, 9 Aug 2022 10:16:18 +0100 Subject: [PATCH] Issue #3285637 by mikelutz, danflanagan8, benjifisher: 'Get' Process plugin should handle multiple --- .../src/Plugin/migrate/process/Get.php | 3 +- .../Kernel/process/HandleMultiplesTest.php | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/core/modules/migrate/src/Plugin/migrate/process/Get.php b/core/modules/migrate/src/Plugin/migrate/process/Get.php index 62240be24e3d..b2775b3e2d93 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/Get.php +++ b/core/modules/migrate/src/Plugin/migrate/process/Get.php @@ -88,7 +88,8 @@ * @see \Drupal\migrate\Plugin\MigrateProcessInterface * * @MigrateProcessPlugin( - * id = "get" + * id = "get", + * handle_multiples = TRUE * ) */ class Get extends ProcessPluginBase { diff --git a/core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php b/core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php index 1319a7bf8a77..548219feb155 100644 --- a/core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php @@ -71,6 +71,32 @@ public function getDefinition() { 'delimiter' => '/', ], ], + // Process pipeline for testing 'get' overriding a single. + 'get_from_single' => [ + // Returns a string. + [ + 'plugin' => 'get', + 'source' => 'scalar', + ], + // Ignore previous and return an array. + [ + 'plugin' => 'get', + 'source' => 'multiple', + ], + ], + // Process pipeline for testing 'get' overriding an array. + 'get_from_multiple' => [ + // Returns an array. + [ + 'plugin' => 'get', + 'source' => 'multiple', + ], + // Ignore previous and return a string. + [ + 'plugin' => 'get', + 'source' => 'scalar', + ], + ], ], 'destination' => [ 'plugin' => 'config', @@ -131,6 +157,11 @@ public function scalarAndMultipleValuesProviderSource() { 'BAR', 'BAZ', ], + 'get_from_single' => [ + 'foo', + 'bar/baz', + ], + 'get_from_multiple' => 'foo/bar', ], ], ]; -- GitLab