Commit d28bbf01 authored by KarenS's avatar KarenS
Browse files

Issue #1150790 Make sure empty values are not saved in migration to match...

Issue #1150790 Make sure empty values are not saved in migration to match bahavior when new empty values are submitted.
parent 819e88cc
......@@ -337,11 +337,21 @@ function _content_migrate_batch_process_migrate_data($field_name, &$context) {
$query->condition('nid', $node['nid']);
$result = $query->execute();
$field = field_info_field($field_name);
foreach ($result as $record) {
// Let modules alter this before the insert.
drupal_alter('content_migrate_data_record', $record, $context['sandbox']['field']);
// Don't save empty values.
if (!empty($record)) {
$function = $field['module'] . '_field_is_empty';
function_exists($function);
if ($function($record, $field)) {
$record = NULL;
}
}
if (!empty($record)) {
if ($record['revision_id'] == $node['vid']) {
drupal_write_record($context['sandbox']['new_table'], $record);
......
......@@ -88,4 +88,4 @@ function content_migrate_text_instance_alter(&$instance_value, $field_value) {
break;
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment