diff --git a/entityreference.feeds.inc b/entityreference.feeds.inc index 3da1479c8..4c0ded91a 100644 --- a/entityreference.feeds.inc +++ b/entityreference.feeds.inc @@ -62,17 +62,18 @@ function entityreference_feeds_processor_targets_alter(&$targets, $entity_type, * user has decided to map to and $value contains the value of the feed item * element the user has picked as a source. * - * @param $source + * @param \FeedsSource $source * A FeedsSource object. - * @param $entity + * @param object $entity * The entity to map to. - * @param $target + * @param string $target * The target key on $entity to map to. - * @param $value + * @param array $value * The value to map. MUST be an array. + * @param array $mapping + * The mapping configuration. */ -function entityreference_feeds_set_target($source, $entity, $target, $value) { - +function entityreference_feeds_set_target(FeedsSource $source, $entity, $target, array $value, array $mapping) { // Don't do anything if we weren't given any data. if (empty($value)) { return; @@ -116,13 +117,15 @@ function entityreference_feeds_set_target($source, $entity, $target, $value) { // Fetch the entity ID resulting from the mapping table look-up. $entity_id = db_select('feeds_item', 'fi') ->fields('fi', array('entity_id')) - ->condition($match_key, $value,'=') + ->condition($match_key, $value, '=') ->execute() ->fetchField(); break; + case 'etid': $entity_id = $value; break; + case 'label': $options = $handler->getReferencableEntities($value, '='); if ($options) { @@ -147,7 +150,7 @@ function entityreference_feeds_set_target($source, $entity, $target, $value) { if ($entity_id) { // Assign the target ID. - $field[$language][$iterator]['target_id'] = $entity_id; + $field[$language][$iterator]['target_id'] = $entity_id; } else /* there is no $entity_id, no mapping */ {