function devel_generate_vocabs in Devel 5
Same name and namespace in other branches
- 6 devel_generate.inc \devel_generate_vocabs()
- 7 devel_generate/devel_generate.inc \devel_generate_vocabs()
1 call to devel_generate_vocabs()
File
- ./
devel_generate.inc, line 159
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'] = rand(0, 10);
taxonomy_save_vocabulary($voc);
$vocs[] = $voc['name'];
}
return $vocs;
}