Verified Commit 88117cbf authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3285637 by mikelutz, danflanagan8, benjifisher: 'Get' Process plugin should handle multiple

(cherry picked from commit 91baefec)
parent 05d1c390
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -88,7 +88,8 @@
 * @see \Drupal\migrate\Plugin\MigrateProcessInterface
 *
 * @MigrateProcessPlugin(
 *   id = "get"
 *   id = "get",
 *   handle_multiples = TRUE
 * )
 */
class Get extends ProcessPluginBase {
+31 −0
Original line number Diff line number Diff line
@@ -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',
        ],
      ],
    ];