diff --git a/migrate_example_advanced/config/install/migrate_plus.migration.wine_role_json.yml b/migrate_example_advanced/config/install/migrate_plus.migration.wine_role_json.yml index 0782e11..e8991a6 100755 --- a/migrate_example_advanced/config/install/migrate_plus.migration.wine_role_json.yml +++ b/migrate_example_advanced/config/install/migrate_plus.migration.wine_role_json.yml @@ -7,6 +7,13 @@ source: plugin: url data_fetcher_plugin: http data_parser_plugin: json + # The data_parser normally limits the fields passed on to the source plugin + # to fields configured to be used as part of the migration. To support more + # dynamic migrations, the JSON data parser supports including the original + # data for the current row. Simply include the 'include_raw_data' flag set + # to `true` to enable this. This option is disabled by default to minimize + # memory footprint for migrations that do not need this capability. + # include_raw_data: true # Normally, this is one or more fully-qualified URLs or file paths. Because # we can't hardcode your local URL, we provide a relative path here which # hook_install() will rewrite to a full URL for the current site. diff --git a/src/Plugin/migrate_plus/data_parser/Json.php b/src/Plugin/migrate_plus/data_parser/Json.php index b96b839..b64a35b 100755 --- a/src/Plugin/migrate_plus/data_parser/Json.php +++ b/src/Plugin/migrate_plus/data_parser/Json.php @@ -114,6 +114,9 @@ class Json extends DataParserPluginBase implements ContainerFactoryPluginInterfa } $this->currentItem[$field_name] = $field_data; } + if (!empty($this->configuration['include_raw_data'])) { + $this->currentItem['raw'] = $current; + } $this->iterator->next(); } }