summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--plugins/destinations/fields.inc7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index aac5845..9b6e94f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -4,6 +4,7 @@ Next release
Features and enhancements
- #1201762 - Implemented built-in caching for source counts, and flag to enable it.
+- #1205278 - Added preserve_files argument to MigrateFileFieldHandler.
- #1205278 - Added preserve_files option to MigrateDestinationFile.
- #1078368 - Implemented create_term argument for term references, to lazy-create terms.
- #1199150 - Added file_fid function to file field migration.
diff --git a/plugins/destinations/fields.inc b/plugins/destinations/fields.inc
index d5e2b9b..cf21369 100644
--- a/plugins/destinations/fields.inc
+++ b/plugins/destinations/fields.inc
@@ -288,6 +288,9 @@ class MigrateFileFieldHandler extends MigrateFieldHandler {
$file_array = $this->buildFileArray($entity, $field_info, $instance, $migration, $arguments, $value);
if (!empty($file_array)) {
$return[$language][$delta] = $file_array;
+ if (!empty($arguments['preserve_files'])) {
+ file_usage_add((object)$file_array, 'migrate', 'file', $file_array['fid']);
+ }
}
}
}
@@ -588,7 +591,9 @@ class MigrateFileFieldHandler extends MigrateFieldHandler {
* array('source_field' => 'source_field_name') to obtain the display value from
* the query field named source_field_name.
*/
- static function arguments($source_path = NULL, $file_function = 'file_copy', $file_replace = FILE_EXISTS_RENAME, $language = NULL, $alt = NULL, $title = NULL, $description = NULL, $display = NULL) {
+ static function arguments($source_path = NULL, $file_function = 'file_copy',
+ $file_replace = FILE_EXISTS_RENAME, $language = NULL, $alt = NULL, $title = NULL,
+ $description = NULL, $display = NULL, $preserve_files = FALSE) {
return get_defined_vars();
}
}