function content_taxonomy_install_terms_by_field in Content Taxonomy 6
Same name and namespace in other branches
- 6.2 content_taxonomy.install \content_taxonomy_install_terms_by_field()
Helper function to get values from term_node table needed in update from 5.x to 6.x
1 call to content_taxonomy_install_terms_by_field()
- content_taxonomy_update_6000 in ./
content_taxonomy.install - Implemenation of hook_update_N().
File
- ./
content_taxonomy.install, line 191
Code
function content_taxonomy_install_terms_by_field($node, $field) {
$terms = array();
if (is_numeric($field['tid']) && $field['tid'] > 0 && $field['depth'] == 1) {
$result = db_query("SELECT n.tid FROM {term_hierarchy} h, {term_node} n, {term_data} td WHERE\n n.nid = %d AND n.tid = h.tid AND h.parent = %d AND td.tid=n.tid AND td.vid=%d", $node->nid, $field['tid'], $field['vid']);
while ($data = db_fetch_array($result)) {
$terms[$data["tid"]] = $data["tid"];
}
}
else {
$result = taxonomy_node_get_terms_by_vocabulary($node, $field['vid']);
foreach ($result as $tid => $term) {
$terms[$tid] = $tid;
}
}
return $terms;
}