You are here

function devel_generate_add_terms in Devel 7

Same name and namespace in other branches
  1. 5 devel_generate.inc \devel_generate_add_terms()
  2. 6 devel_generate.inc \devel_generate_add_terms()

File

devel_generate/devel_generate.inc, line 566

Code

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