taxonomy_form_all

Versions
4.6
taxonomy_form_all($value = 0, $help = NULL, $name = 'taxonomy')
4.7 – 6
taxonomy_form_all($free_tags = 0)
7
taxonomy_form_all()

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

Code

modules/taxonomy.module, line 396

<?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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.