• Avail guidance to develop Drupal modules & Drupal themes
  • Share and get review of your code
  • Get Access to free CodeBooks and ThemeBooks
  • Drupal 5, 6 and 7 covered

Dernières Petites Annonces

December 2009

Programmatically create vocabulary

2
0

Imagine a situation in which you are developing a custom module and would like to create a vocabulary when ever your module is installed on a Drupal site. You can instruct the user to create a vocabulary with desired name and settings but the best approach to this situation is to create a vocabulary from the code and populate it with terms right within the module you have developed. This will reduce dependency and the user need not have to configure it manually. This will result in more use of module.

To create a vocabulary using the code you need the function taxonomy_save_vocabulary($vocabullary)
where $vocabullary is an associative array containing information about the vocabulary being created.
The $vocabulary would be:
<?php
$vocabulary = array(

Syndiquer le contenu

Sitestats

Recent comments

rss-top-right.png
toolbar powered by www.iconcy.com