function devel_generate_vocabs
Same name in other branches
- 7.x-1.x devel_generate/devel_generate.inc \devel_generate_vocabs()
1 call to devel_generate_vocabs()
File
-
./
devel_generate.inc, line 105
Code
function devel_generate_vocabs($records, $maxlength = 12, $types = array(
'story',
'blog',
'forum',
'page',
)) {
$vocs = array();
// Insert new data:
for ($i = 1; $i <= $records; $i++) {
$voc = array();
$voc['name'] = devel_generate_word(rand(2, $maxlength));
$voc['description'] = "description of " . $voc['name'];
$voc['nodes'] = array_flip(array(
$types[array_rand($types)],
));
foreach ($voc['nodes'] as $key => $value) {
$voc['nodes'][$key] = $key;
}
$voc['multiple'] = 1;
$voc['required'] = 0;
$voc['relations'] = 1;
$voc['hierarchy'] = 1;
$voc['weight'] = mt_rand(0, 10);
taxonomy_save_vocabulary($voc);
$vocs[] = $voc['name'];
}
return $vocs;
}