protected function FeedsProcessor::uniqueTargets in Feeds 6
Same name and namespace in other branches
- 7.2 plugins/FeedsProcessor.inc \FeedsProcessor::uniqueTargets()
- 7 plugins/FeedsProcessor.inc \FeedsProcessor::uniqueTargets()
Utility function that iterates over a target array and retrieves all sources that are unique.
Parameters
$batch: A FeedsImportBatch.
Return value
An array where the keys are target field names and the values are the elements from the source item mapped to these targets.
5 calls to FeedsProcessor::uniqueTargets()
- FeedsDataProcessor::existingItemId in plugins/
FeedsDataProcessor.inc - Iterate through unique targets and try to load existing records. Return id for the first match.
- FeedsFeedNodeProcessor::existingItemId in plugins/
FeedsFeedNodeProcessor.inc - Get nid of an existing feed item node if available.
- FeedsNodeProcessor::existingItemId in plugins/
FeedsNodeProcessor.inc - Get nid of an existing feed item node if available.
- FeedsTermProcessor::existingItemId in plugins/
FeedsTermProcessor.inc - Get id of an existing feed item term if available.
- FeedsUserProcessor::existingItemId in plugins/
FeedsUserProcessor.inc - Get id of an existing feed item term if available.
File
- plugins/
FeedsProcessor.inc, line 228
Class
- FeedsProcessor
- Abstract class, defines interface for processors.
Code
protected function uniqueTargets(FeedsImportBatch $batch) {
$parser = feeds_importer($this->id)->parser;
$targets = array();
foreach ($this->config['mappings'] as $mapping) {
if ($mapping['unique']) {
// Invoke the parser's getSourceElement to retrieve the value for this
// mapping's source.
$targets[$mapping['target']] = $parser
->getSourceElement($batch, $mapping['source']);
}
}
return $targets;
}