Index: modules/hs_taxonomy.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/hierarchical_select/modules/hs_taxonomy.module,v retrieving revision 1.41 diff -u -F '^f' -r1.41 hs_taxonomy.module --- modules/hs_taxonomy.module 28 Feb 2010 20:33:53 -0000 1.41 +++ modules/hs_taxonomy.module 1 Mar 2010 20:07:16 -0000 @@ -391,7 +391,7 @@ function hs_taxonomy_hierarchical_select return array(0); } - $terms = array_reverse(taxonomy_get_parents_all($item)); + $terms = array_reverse(hs_taxonomy_get_parents_all($item)); foreach ($terms as $term) { $lineage[] = $term->tid; } @@ -399,6 +399,24 @@ function hs_taxonomy_hierarchical_select } /** + * Alternative version of taxonomy_get_parents_all(): instead of using all + * parents of a term (i.e. when multiple parents are being used), only the + * first is kept. + */ +function hs_taxonomy_get_parents_all($tid) { + $parents = array(); + if ($tid) { + $parents[] = taxonomy_get_term($tid); + $n = 0; + while ($parent = taxonomy_get_parents($parents[$n]->tid)) { + $parents = array_merge($parents, array(reset($parent))); + $n++; + } + } + return $parents; +} + +/** * Implementation of hook_hierarchical_select_valid_item(). */ function hs_taxonomy_hierarchical_select_valid_item($item, $params) {