You are here

function _taxonomy_hierarchical_select_terms_to_options in Hierarchical Select 5.2

Same name and namespace in other branches
  1. 5 modules/taxonomy.inc \_taxonomy_hierarchical_select_terms_to_options()

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.

3 calls to _taxonomy_hierarchical_select_terms_to_options()
content_taxonomy_hierarchical_select_children in modules/content_taxonomy.inc
Implementation of hook_hierarchical_select_children().
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 366

Code

function _taxonomy_hierarchical_select_terms_to_options($terms) {
  $options = array();
  foreach ($terms as $key => $term) {

    // Use the translated term when available!
    $options[$term->tid] = t($term->name);
  }
  return $options;
}