protected function FeedsProcessor::uniqueTargets in Feeds 8.2
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.
4 calls to FeedsProcessor::uniqueTargets()
- FeedsNodeProcessor::existingEntityId in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsNodeProcessor.php - Get nid of an existing feed item node if available.
- FeedsProcessor::existingEntityId in lib/
Drupal/ feeds/ Plugin/ FeedsProcessor.php - Retrieve the target entity's existing id if available. Otherwise return 0.
- FeedsTermProcessor::existingEntityId in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsTermProcessor.php - Get id of an existing feed item term if available.
- FeedsUserProcessor::existingEntityId in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsUserProcessor.php - Get id of an existing feed item term if available.
File
- lib/
Drupal/ feeds/ Plugin/ FeedsProcessor.php, line 781 - Contains FeedsProcessor and related classes.
Class
- FeedsProcessor
- Abstract class, defines interface for processors.
Namespace
Drupal\feeds\PluginCode
protected function uniqueTargets(FeedsSource $source, FeedsParserResult $result) {
$parser = feeds_importer($this->id)->parser;
$targets = array();
foreach ($this->config['mappings'] as $mapping) {
if (!empty($mapping['unique'])) {
// Invoke the parser's getSourceElement to retrieve the value for this
// mapping's source.
$targets[$mapping['target']] = $parser
->getSourceElement($source, $result, $mapping['source']);
}
}
return $targets;
}