Index: modules/hs_taxonomy.module =================================================================== --- modules/hs_taxonomy.module (revision 10) +++ modules/hs_taxonomy.module (working copy) @@ -642,11 +642,28 @@ } } + // Build consistency to handle all three forms of $node->taxonomy + foreach ($node->taxonomy as $key => $item) { + if (is_object($item)) { + $terms_by_vocab[$item->vid][$item->tid] = $item->tid; + } + elseif (is_array($item)) { + foreach ($item as $index => $term) { + $term = is_object($term) ? $term : taxonomy_get_term($term); + $terms_by_vocab[$term->vid][$term->tid] = $term->tid; + } + } + elseif (is_numeric($item)) { + $term = taxonomy_get_term($item); + $terms_by_vocab[$term->vid][$term->tid] = $term->tid; + } + } + // Generate the per-vid "save-lineage-termpath" tokens. foreach ($all_vids as $vid) { $terms = array(); if (in_array($vid, $hs_vids) && isset($node->taxonomy[$vid])) { - $selection = $node->taxonomy[$vid]; + $selection = $terms_by_vocab[$vid]; $terms = _hs_taxonomy_token_termpath_for_vid($selection, $vid); } @@ -656,15 +673,14 @@ // We use the terms of the first vocabulary that uses Hierarchical // Select for the default "save-lineage-termpath" tokens. - $vids = array_intersect(array_keys($node->taxonomy), $hs_vids); + $vids = array_intersect(array_keys($terms_by_vocab), $hs_vids); if (!empty($vids)) { $vid = $vids[0]; - $values['save-lineage-termpath'] = implode($separator, array_map('check_plain', $terms)); - $values['save-lineage-termpath-raw'] = implode($separator, $terms); + $values['save-lineage-termpath'] = $values['save-lineage-termpath:' . $vid]; + $values['save-lineage-termpath-raw'] = $values['save-lineage-termpath-raw:' . $vid]; } break; } - return $values; }