diff --git a/domain_feeds.module b/domain_feeds.module index b6fe267..63989ec 100644 --- a/domain_feeds.module +++ b/domain_feeds.module @@ -45,7 +45,7 @@ function domain_feeds_feeds_processor_targets_alter(&$targets, $entity_type, $bu */ function domain_feeds_set_target($source, $entity, $target, array $values, $mapping) { list($target, $sub_field) = explode(':', $target); - $field = isset($entity->$target) ? $entity->$target : array(); + $field = !empty($entity->$target) ? $entity->$target : array(); $value = reset($values); @@ -56,10 +56,12 @@ function domain_feeds_set_target($source, $entity, $target, array $values, $mapp $field[$sub_field] = $value ? $sub_field : 0; } - $entity->$target = $field; - $entity->domain_site = 0; + if (count($field)) { + $entity->$target = $field; + $entity->domain_site = 0; + } - return $node; + return $entity; } /** @@ -69,9 +71,9 @@ function domain_feeds_set_target($source, $entity, $target, array $values, $mapp * user has decided to map to and $value contains the value of the feed item * element the user has picked as a source. */ -function domain_feeds_set_target_all($node, $target, $value) { - $node->domain_site = 1; - $node->domain_source = 0; - $node->domains = array(-1 => -1); - return $node; +function domain_feeds_set_target_all($source, $entity, $target, $feed_element) { + $entity->domain_site = 1; + $entity->domain_source = 0; + + return $entity; }