diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-11-28 12:24:58 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-11-28 12:24:58 +0000 |
commit | 42518af257afecf3eac06dccd9c0a1aac1087fa0 (patch) | |
tree | 8ba81a95c0314605eb647c9be9b716f7a1703cd7 /modules/taxonomy/taxonomy.module | |
parent | 74b6c00b8869346ce2b13602e9604629428f563a (diff) | |
download | brdo-42518af257afecf3eac06dccd9c0a1aac1087fa0.tar.gz brdo-42518af257afecf3eac06dccd9c0a1aac1087fa0.tar.bz2 |
- Bring back taxonomy_form_all().
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 1f1ac3048..701645957 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -452,6 +452,26 @@ function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') { } /** + * Generate a set of options for selecting a term from all vocabularies. Can be + * passed to form_select. + */ +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); + $options[$vocabulary->name] = array(); + if ($tree) { + foreach ($tree as $term) { + $options[$vocabulary->name][$term->tid] = _taxonomy_depth($term->depth, '-') . $term->name; + } + } + } + return $options; +} + +/** * Return an array of all vocabulary objects. * * @param $type |