You are here

function devel_generate_add_terms in Devel 6

Same name and namespace in other branches
  1. 5 devel_generate.inc \devel_generate_add_terms()
  2. 7 devel_generate/devel_generate.inc \devel_generate_add_terms()
1 call to devel_generate_add_terms()
devel_generate_nodeapi in ./devel_generate.inc

File

./devel_generate.inc, line 361

Code

function devel_generate_add_terms(&$node) {
  $vocabs = taxonomy_get_vocabularies($node->type);
  foreach ($vocabs as $vocab) {
    $sql = "SELECT tid FROM {term_data} WHERE vid = %d ORDER BY RAND()";
    $result = db_query_range($sql, $vocab->vid, 0, 5);
    while ($row = db_fetch_object($result)) {
      $node->taxonomy[] = $row->tid;
      if (!$vocab->multiple) {
        break;
      }
    }
  }
}