function taxonomy_term_view_multiple
7.x taxonomy.module | taxonomy_term_view_multiple($terms, $view_mode = 'teaser', $weight = 0, $langcode = NULL) |
Constructs a drupal_render() style array from an array of loaded terms.
Parameters
$terms: An array of taxonomy terms as returned by taxonomy_term_load_multiple().
$view_mode: View mode, e.g. 'full', 'teaser'...
$weight: An integer representing the weight of the first taxonomy term in the list.
$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.
Return value
An array in the format expected by drupal_render().
1 call to taxonomy_term_view_multiple()
- taxonomy_term_show in drupal-7.x/
modules/ taxonomy/ taxonomy.module - Generates an array which displays a term detail page.
File
- drupal-7.x/
modules/ taxonomy/ taxonomy.module, line 773 - Enables the organization of content into categories.
Code
function taxonomy_term_view_multiple($terms, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
field_attach_prepare_view('taxonomy_term', $terms, $view_mode, $langcode);
entity_prepare_view('taxonomy_term', $terms, $langcode);
$build = array();
foreach ($terms as $term) {
$build['taxonomy_terms'][$term->tid] = taxonomy_term_view($term, $view_mode, $langcode);
$build['taxonomy_terms'][$term->tid]['#weight'] = $weight;
$weight++;
}
$build['taxonomy_terms']['#sorted'] = TRUE;
return $build;
}