taxonomy_get_vocabularies

5 taxonomy.module taxonomy_get_vocabularies($type = NULL)
6 taxonomy.module taxonomy_get_vocabularies($type = NULL)
7 taxonomy.module taxonomy_get_vocabularies()

Return an array of all vocabulary objects.

Return value

An array of all vocabulary objects, indexed by vid.

11 calls to taxonomy_get_vocabularies()

File

modules/taxonomy/taxonomy.module, line 866
Enables the organization of content into categories.

Code

function taxonomy_get_vocabularies() {
  return taxonomy_vocabulary_load_multiple(FALSE, array());
}

Comments

A check list box of Vocabulary Names

This snippet will create a checkbox list of Vocabulary names. Could easily be changed for a select list ( '#type' => 'select', ) .

function YOUR_FUNCTION_NAME() {

  $vocabulary = taxonomy_get_vocabularies();
  $checklist_vocab_array = array(); /* Change to array('0' => '--none--'); if you want a none option*/
  foreach ($vocabulary as $item) {
  $key = $item->vid;
  $value = $item->name;
  $checklist_vocab_array[$key] = $value;
  }

  $form['YOUR_MODULE_NAME_YOUR_FORM_NAME'] = array(
    '#type'             => 'checkboxes',
    '#title'            => t('List of current Vocabularies.'),
    '#position'         => 'left' ,
    '#options'          => $checklist_vocab_array ,
    '#default_value'    => variable_get('YOUR_MODULE_NAME_YOUR_FORM_NAME'),
    '#description'      => t('List of vocabularies displayed as checkboxes'),
  );
     return system_settings_form($form);
}

Login or register to post comments