--- c:\temp\TCV6ac2.tmp\category_legacy.1.1.module Tue Aug 15 20:12:49 2006 +++ category_legacy\category_legacy.module Tue Aug 15 20:12:06 2006 @@ -1287,10 +1287,16 @@ * @param $term * The term array, as plucked out from the vocab tree. * + * @param $cnid + * The container to assign the new term to. + * + * @param $parent_map + * An array of mappings. Key = tid, value = cid. + * * @return * A node object ready to be saved. */ -function category_legacy_build_category_from_term($term, $cnid, $parent_map = array()) { +function category_legacy_build_category_from_term($term, $cnid, &$parent_map) { $node = (object) $term; $node->title = $node->name; @@ -1311,9 +1317,9 @@ } } - foreach ($node->parents as $key => $parent) { + foreach ($node->parents as $parent) { if ($parent && $parent_map[$parent]) { - $node->parents[$key] = $parent_map[$parent]; + $node->parents[] = $parent_map[$parent]; } } if (empty($node->parents) || empty($node->parents[0])) { @@ -1353,10 +1359,16 @@ * @param $node * The node object, as plucked out from the category tree. * + * @param $vid + * The vocabulary ID to place the term into. + * + * @param $parent_map + * An array of mappings. Key = cid, value = tid. + * * @return * A term object ready to be saved. */ -function category_legacy_build_term_from_category($node, $vid, $parent_map = array()) { +function category_legacy_build_term_from_category($node, $vid, &$parent_map) { $term = array(); $term['name'] = $node['title'];