Skip to content
Snippets Groups Projects
Commit 88f57127 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #2379915 by hydrant-mark, twistor: Taxonomy Mapper: Assumes there will...

Issue #2379915 by hydrant-mark, twistor: Taxonomy Mapper: Assumes there will only ever be one matching term
parent c3b712d1
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,14 @@ function taxonomy_feeds_set_target($source, $entity, $target, array $terms, $map
$term = trim($term);
$name_query = clone $query;
if (strlen($term) && $tids = $name_query->propertyCondition('name', $term)->execute()) {
$tid = key($tids['taxonomy_term']);
// Find the first allowed term.
foreach ($tids['taxonomy_term'] as $possible_term) {
if (isset($cache['allowed_values'][$target][$possible_term->tid])) {
$tid = $possible_term->tid;
break;
}
}
}
elseif ($mapping['autocreate'] && strlen($term)) {
$term = (object) array(
......@@ -154,7 +161,7 @@ function taxonomy_feeds_set_target($source, $entity, $target, array $terms, $map
// Lookup by tid.
case FEEDS_TAXONOMY_SEARCH_TERM_ID:
if (is_numeric($term)) {
$tid = $term;
$tid = (int) $term;
}
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment