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.

Code

modules/taxonomy/taxonomy.module, line 637

<?php
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) > 0)) {
      $options[$vocabulary->name] = array();
      foreach ($tree as $term) {
        $options[$vocabulary->name][$term->tid] = str_repeat('-', $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.