1 taxonomy.module taxonomy_term_view_multiple($terms, $view_mode = 'teaser', $weight = 0, $langcode = NULL)

Constructs a backdrop_render() style array from an array of loaded terms.


$terms: An array of taxonomy terms as returned by taxonomy_term_load_multiple().

$view_mode: (optional) Display mode, e.g. 'full' or 'teaser'. Defaults to 'teaser'.

$weight: (optional) An integer representing the weight of the first taxonomy term.

$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 backdrop_render().:


core/modules/taxonomy/taxonomy.module, line 763
Enables the organization of content into categories.


function taxonomy_term_view_multiple($terms, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
  $build = array();
  $entities_by_view_mode = entity_view_mode_prepare('taxonomy_term', $terms, $view_mode, $langcode);
  foreach ($entities_by_view_mode as $entity_view_mode => $entities) {
    field_attach_prepare_view('taxonomy_term', $entities, $entity_view_mode, $langcode);
    entity_prepare_view('taxonomy_term', $entities, $langcode);

    foreach ($entities as $entity) {
      $build['taxonomy_terms'][$entity->tid] = taxonomy_term_view($entity, $entity_view_mode, $langcode);

  foreach ($terms as $term) {
    $build['taxonomy_terms'][$term->tid]['#weight'] = $weight;
  // Sort here, to preserve the input order of the entities that were passed to
  // this function.
  backdrop_sort($build['taxonomy_terms'], array('#weight'));
  $build['taxonomy_terms']['#sorted'] = TRUE;

  return $build;