function _taxonomy_hierarchical_select_terms_to_options in Hierarchical Select 5
Same name and namespace in other branches
- 5.2 modules/taxonomy.inc \_taxonomy_hierarchical_select_terms_to_options()
Helper function to transform an array of terms into an associative array of options, for use in a select form item.
Parameters
$terms: An array of term objects.
Return value
An associative array of options, keys are tids, values are term names.
2 calls to _taxonomy_hierarchical_select_terms_to_options()
- taxonomy_hierarchical_select_children in modules/
taxonomy.inc - Implementation of hook_hierarchical_select_children().
- taxonomy_hierarchical_select_root_level in modules/
taxonomy.inc - Implementation of hook_hierarchical_select_root_level().
File
- modules/
taxonomy.inc, line 190
Code
function _taxonomy_hierarchical_select_terms_to_options($terms) {
$options = array();
foreach ($terms as $key => $term) {
$options[$term->tid] = $term->name;
}
return $options;
}