Drupal 使用 taxonomy_save_vocabulary() 函数创建词汇表(Vocabulary),通过定义词汇表数组,然后作为参数传入 taxonomy_save_vocabulary() 函数,程序执行时便可将定义的词汇表添加进数据库。
<?php
$article_category = array(
'name' => t('Article Categories'),
'description' => t('Select the appropriate category for your article.'),
'nodes' => array('article' => st('Article')),
'help' => '',
'hierarchy' => 1,
'relations' => 0,
'tags' => 0,
'multiple' => 0,
'required' => 0,
);
taxonomy_save_vocabulary($article_category);
?>