diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index ee88ba8..12f2e65 100644 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -696,6 +696,8 @@ abstract class FeedsProcessor extends FeedsPlugin { */ protected function map(FeedsSource $source, FeedsParserResult $result, $target_item = NULL) { $targets = $this->getCachedTargets(); + // Get fields for the entity type we are mapping to. + $fields = field_info_instances($this->entityType(), $this->bundle()); if (empty($target_item)) { $target_item = array(); @@ -706,10 +708,20 @@ abstract class FeedsProcessor extends FeedsPlugin { // mapping on a prepopulated item such as an existing node. foreach ($this->config['mappings'] as $mapping) { if (isset($targets[$mapping['target']]['real_target'])) { - $target_item->{$targets[$mapping['target']]['real_target']} = NULL; + $target_name = $targets[$mapping['target']]['real_target']; } else { - $target_item->{$mapping['target']} = NULL; + $target_name = $mapping['target']; + } + + // If the target is a field and a mapping language is specified, empty the + // value for the targeted language only. + // In all other cases, just empty the target completely. + if (isset($mapping['field_language']) && isset($fields[$target_name])) { + $target_item->{$target_name}[$mapping['field_language']] = array(); + } + else { + $target_item->{$target_name} = NULL; } }