function 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;
            }
        }
    }
}