diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index d2d13dd..79c5d38 100644 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -715,24 +715,26 @@ abstract class FeedsProcessor extends FeedsPlugin { // Many mappers add to existing fields rather than replacing them. Hence we // need to clear target elements of each item before mapping in case we are // mapping on a prepopulated item such as an existing node. - foreach ($this->getMappings() as $mapping) { - if (isset($targets[$mapping['target']]['real_target'])) { - $target_name = $targets[$mapping['target']]['real_target']; - } - else { - $target_name = $mapping['target']; - } - - // If the target is a field empty the value for the targeted language - // only. - // In all other cases, just empty the target completely. - if (isset($fields[$target_name])) { - // Empty the target for the specified language. - $target_item->{$target_name}[$mapping['language']] = array(); - } - else { - // Empty the whole target. - $target_item->{$target_name} = NULL; + // First, allow processors to disable "nulling" of values when empty. + if (empty($this->config['prevent_null_overwrite'])) { + foreach ($this->getMappings() as $mapping) { + if (isset($targets[$mapping['target']]['real_target'])) { + $target_name = $targets[$mapping['target']]['real_target']; + } + else { + $target_name = $mapping['target']; + } + // If the target is a field empty the value for the targeted language + // only. + // In all other cases, just empty the target completely. + if (isset($fields[$target_name])) { + // Empty the target for the specified language. + $target_item->{$target_name}[$mapping['language']] = array(); + } + else { + // Empty the whole target. + $target_item->{$target_name} = NULL; + } } }