You are here

function taxonomy_feeds_get_source in Feeds 6

Same name and namespace in other branches
  1. 8.2 mappers/taxonomy.inc \taxonomy_feeds_get_source()
  2. 7.2 mappers/taxonomy.inc \taxonomy_feeds_get_source()
  3. 7 mappers/taxonomy.inc \taxonomy_feeds_get_source()

Callback, returns taxonomy from feed node.

1 string reference to 'taxonomy_feeds_get_source'
taxonomy_feeds_parser_sources_alter in mappers/taxonomy.inc
Implementation of hook_feeds_parser_sources_alter().

File

mappers/taxonomy.inc, line 26
Mapper that exposes a node's taxonomy vocabularies as mapping targets.

Code

function taxonomy_feeds_get_source(FeedsImportBatch $batch, $key) {
  if ($node = node_load($batch->feed_nid)) {
    $terms = taxonomy_node_get_terms($node);
    $vocabulary = taxonomy_get_vocabulary(str_replace('parent:taxonomy:', '', $key));
    $result = array();
    foreach ($terms as $tid => $term) {
      if ($term->vid == $vocabulary->vid) {
        $result[] = new FeedsTermElement($term);
      }
    }
    return $result;
  }
}