Index: taxonomy.module =================================================================== --- taxonomy.module (revision 2218) +++ taxonomy.module (revision 2219) @@ -421,15 +421,15 @@ $exclude[] = $edit['tid']; if ($vocabulary->hierarchy == 1) { - $form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary_id, l(t('Parent term'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 0, '<'. t('root') .'>', $exclude); + $form['parent'] = theme('taxonomy_term_select_field', t('Parent'), 'parent', $parent, $vocabulary_id, l(t('Parent term'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 0, '<'. t('root') .'>', $exclude); } elseif ($vocabulary->hierarchy == 2) { - $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary_id, l(t('Parent terms'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 1, '<'. t('root') .'>', $exclude); + $form['parent'] = theme('taxonomy_term_select_field', t('Parents'), 'parent', $parent, $vocabulary_id, l(t('Parent terms'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 1, '<'. t('root') .'>', $exclude); } } if ($vocabulary->relations) { - $form['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary_id, NULL, 1, '<'. t('none') .'>', array($edit['tid'])); + $form['relations'] = theme('taxonomy_term_select_field', t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary_id, NULL, 1, '<'. t('none') .'>', array($edit['tid'])); } $form['synonyms'] = array( @@ -618,8 +618,21 @@ /** * Generate a form element for selecting terms from a vocabulary. - */ -function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') { + * + * @param $vid + * Vocabulary id. + * @param $value + * The currently selected value. + * @param $help + * The description of what this vocabulary represents. If NULL, the value is + * taken from the vocabulary itself ($vocabulary->help). + * @param $name + * The name parameter of the form item being built. Set this if you want to use + * the vocabulary list to set fields other than taxonomy. + * @param $title + * The label on the form item. If left NULL, it will default to the vocabulary name. + */ +function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy', $title = NULL) { $vocabulary = taxonomy_get_vocabulary($vid); $help = ($help) ? $help : $vocabulary->help; @@ -630,7 +643,10 @@ $blank = ($vocabulary->required) ? 0 : t('- None -'); } - return _taxonomy_term_select(check_plain($vocabulary->name), $name, $value, $vid, $help, intval($vocabulary->multiple), $blank); + if (!isset($title)) { + $title = $vocabulary->name; + } + return theme('taxonomy_term_select_field', check_plain($title), $name, $value, $vid, $help, intval($vocabulary->multiple), $blank); } /** @@ -1177,7 +1193,30 @@ return $terms[$tid]; } -function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) { +/** + * Theme a form element for selecting terms from a vocabulary. + * + * @param $title + * The label on the form item. If left NULL, it will default to the vocabulary name. + * @param $name + * The name parameter of the form item being built. Set this if you want to use + * the vocabulary list to set fields other than taxonomy. + * @param $value + * The currently selected value. + * @param $vid + * Vocabulary id. + * @param $description + * The description of what this vocabulary represents. If NULL, the value is + * taken from the vocabulary itself ($vocabulary->help). + * @param $multiple + * Can multiple terms be selected? + * @param $blank + * If this form element is not required, the $blank element will be the first + * in the list. + * @param $exclude + * an array of term ids that shouldn't appear in the list. + */ +function theme_taxonomy_term_select_field($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) { $tree = taxonomy_get_tree($vocabulary_id); $options = array();