You are here

protected function FeedsProcessor::uniqueTargets in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsProcessor.inc \FeedsProcessor::uniqueTargets()
  2. 7 plugins/FeedsProcessor.inc \FeedsProcessor::uniqueTargets()

Returns all mapping targets that are marked as unique.

Parameters

FeedsSource $source: The source information about this import.

FeedsParserResult $result: A FeedsParserResult object.

Return value

array 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 plugins/FeedsNodeProcessor.inc
Get nid of an existing feed item node if available.
FeedsProcessor::existingEntityId in plugins/FeedsProcessor.inc
Retrieve the target entity's existing id if available. Otherwise return 0.
FeedsTermProcessor::existingEntityId in plugins/FeedsTermProcessor.inc
Get id of an existing feed item term if available.
FeedsUserProcessor::existingEntityId in plugins/FeedsUserProcessor.inc
Get id of an existing feed item term if available.

File

plugins/FeedsProcessor.inc, line 1319
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

protected function uniqueTargets(FeedsSource $source, FeedsParserResult $result) {
  $parser = feeds_importer($this->id)->parser;
  $targets = array();
  foreach ($this
    ->getMappings() 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;
}