taxonomy_form_all

Definition

taxonomy_form_all($value = 0, $help = NULL, $name = 'taxonomy')
modules/taxonomy.module, line 396

Description

Generate a set of options for selecting a term from all vocabularies. Can be passed to form_select.

Code

<?php
function taxonomy_form_all($value = 0, $help = NULL, $name = 'taxonomy') {
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabularies as $vid => $vocabulary) {
    $tree = taxonomy_get_tree($vid);
    $options[$vocabulary->name] = array();
    if ($tree) {
      foreach ($tree as $term) {
        $options[$vocabulary->name][$term->tid] = _taxonomy_depth($term->depth, '-') . $term->name;
      }
    }
  }
  return $options;
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.