function revisioning_get_tids in Revisioning 7
Same name and namespace in other branches
- 8 revisioning.taxonomy.inc \revisioning_get_tids()
Return array of all taxonomy term ids belonging to the supplied revision.
Parameters
int $vid: the revision id
1 call to revisioning_get_tids()
- revisioning_update_taxonomy_index in ./
revisioning.taxonomy.inc - Updates the {taxonomy_index} table.
File
- ./
revisioning.taxonomy.inc, line 63 - Code required only when the Taxonomy module is enabled.
Code
function revisioning_get_tids($vid) {
$tids = array();
$conditions = array(
'type' => 'taxonomy_term_reference',
);
$fields = field_read_fields($conditions);
foreach ($fields as $field => $data) {
$sql = "SELECT {$field}_tid AS tid FROM {field_revision_{$field}} WHERE revision_id = :vid AND entity_type = 'node' AND deleted = 0 ORDER BY tid";
$result = db_query($sql, array(
':vid' => $vid,
));
foreach ($result as $term) {
$tids[$term->tid] = $term->tid;
}
}
return $tids;
}