From 42518af257afecf3eac06dccd9c0a1aac1087fa0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 28 Nov 2005 12:24:58 +0000 Subject: - Bring back taxonomy_form_all(). --- modules/taxonomy/taxonomy.module | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'modules/taxonomy/taxonomy.module') 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 @@ -451,6 +451,26 @@ function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') { return _taxonomy_term_select(check_plain($vocabulary->name), $name, $value, $vid, $help, intval($vocabulary->multiple), $blank); } +/** + * 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. * -- cgit v1.2.3