From bec3f3efe8dfbc06b899d63f5d45526703fa3eab Mon Sep 17 00:00:00 2001 From: Zombienaute <Zombienaute@1036766.no-reply.drupal.org> Date: Tue, 11 Oct 2016 15:22:05 -0500 Subject: [PATCH] Issue #2792765 by acbramley: Allow XML elements to pass through as field values to process plugins --- src/Plugin/migrate_plus/data_parser/Xml.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Plugin/migrate_plus/data_parser/Xml.php b/src/Plugin/migrate_plus/data_parser/Xml.php index 8235e3f2..0213a0f7 100644 --- a/src/Plugin/migrate_plus/data_parser/Xml.php +++ b/src/Plugin/migrate_plus/data_parser/Xml.php @@ -239,7 +239,15 @@ class Xml extends DataParserPluginBase { $values = $target_element->xpath($xpath); } foreach ($values as $value) { - $this->currentItem[$field_name][] = (string) $value; + // If the SimpleXMLElement doesn't render to a string of any sort, + // and has children then return the whole object for the process + // plugin or other row manipulation. + if ($value->children() && !trim((string) $value)) { + $this->currentItem[$field_name] = $value; + } + else { + $this->currentItem[$field_name][] = (string) $value; + } } } // Reduce single-value results to scalars. -- GitLab