Drupal function to return content types associated with a term

102 Views Asked by At

I am looking for a function which will list out the content types which a specific term (tid) can be applied to.

There doesn't seem to be a direct way to do it from http://api.drupal.org/api/search/6/taxonomy.

Any ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

No, there doesn't seem to be one. You should be able to use this query, though.

$c = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);

Source: http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function/taxonomy_form_alter/6

Or a simplified version of that, if you for example only need the vid.