--- hs_taxonomy.module.20100408 2010-04-08 12:52:29.000000000 -0700 +++ hs_taxonomy.module 2010-04-09 12:26:11.000000000 -0700 @@ -542,11 +542,25 @@ function hs_taxonomy_token_values($type, } } + // 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; + } + else if (is_array($item)) { + $terms_by_vocab[$key] = $item; + } + else if ($item) { + $term = taxonomy_get_term($item); + $terms_by_vocab[$term->vid][] = $term->tid; + } + } + // Generate the per-vid "save-lineage-termpath" tokens. foreach ($all_vids as $vid) { $terms = array(); if (in_array($vid, $hs_vids)) { - $selection = $node->taxonomy[$vid]; + $selection = $terms_by_vocab[$vid]; $terms = _hs_taxonomy_token_termpath_for_vid($selection, $vid); } @@ -556,7 +570,7 @@ function hs_taxonomy_token_values($type, // 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));