function taxonomy_feeds_get_source in Feeds 7
Same name and namespace in other branches
- 8.2 mappers/taxonomy.inc \taxonomy_feeds_get_source()
- 6 mappers/taxonomy.inc \taxonomy_feeds_get_source()
- 7.2 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 - Implements 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 = $batch
->feedNode()) {
$terms = taxonomy_node_get_terms($node);
$vocabularies = taxonomy_vocabulary_load_multiple(array(), array(
'machine_name' => str_replace('parent:taxonomy:', '', $key),
));
$vocabulary = array_shift($vocabularies);
$result = array();
foreach ($terms as $tid => $term) {
if ($term->vid == $vocabulary->vid) {
$result[] = new FeedsTermElement($term);
}
}
return $result;
}
}