Same name and namespace in other branches
  1. 4.6.x modules/taxonomy.module \taxonomy_form_all()
  2. 5.x modules/taxonomy/taxonomy.module \taxonomy_form_all()
  3. 6.x modules/taxonomy/taxonomy.module \taxonomy_form_all()

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

File

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

Code

function taxonomy_form_all($free_tags = 0) {
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabularies as $vid => $vocabulary) {
    if ($vocabulary->tags && !$free_tags) {
      continue;
    }
    $tree = taxonomy_get_tree($vid);
    if ($tree && count($tree) > 1) {
      $options[$vocabulary->name] = array();
      foreach ($tree as $term) {
        $options[$vocabulary->name][$term->tid] = _taxonomy_depth($term->depth, '-') . $term->name;
      }
    }
  }
  return $options;
}