You are here

protected function FeedsTermProcessor::map in Feeds 6

Same name and namespace in other branches
  1. 7 plugins/FeedsTermProcessor.inc \FeedsTermProcessor::map()

Execute mapping on an item.

Overrides FeedsProcessor::map

1 call to FeedsTermProcessor::map()
FeedsTermProcessor::process in plugins/FeedsTermProcessor.inc
Implementation of FeedsProcessor::process().

File

plugins/FeedsTermProcessor.inc, line 146
FeedsTermProcessor class.

Class

FeedsTermProcessor
Feeds processor plugin. Create taxonomy terms from feed items.

Code

protected function map(FeedsImportBatch $batch, $target_term = NULL) {

  // Prepare term object.
  if (empty($target_term)) {
    $target_term = array();
  }

  // Verify vocabulary.
  if (!($vocabulary = $this
    ->vocabulary())) {
    throw new Exception(t('No vocabulary specified for term processor'));
  }
  $target_term['vid'] = $vocabulary->vid;

  // Have parent class do the mapping.
  $target_term = parent::map($batch, $target_term);

  // Taxonomy module expects synonyms to be supplied as a single string.
  if (isset($target_term['synonyms']) && is_array($target_term['synonyms'])) {
    $target_term['synonyms'] = implode("\n", $target_term['synonyms']);
  }
  return $target_term;
}