function taxonomy_term_view_multiple

Same name in other branches
  1. 7.x modules/taxonomy/taxonomy.module \taxonomy_term_view_multiple()

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

Parameters

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

string $view_mode: View mode; e.g., 'full', 'teaser', etc.

string $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

array An array in the format expected by \Drupal\Core\Render\RendererInterface::render().

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term')->viewMultiple() instead.

See also

https://www.drupal.org/node/3033656

1 call to taxonomy_term_view_multiple()
TaxonomyLegacyTest::testTaxonomyTermView in core/modules/taxonomy/tests/src/Kernel/TaxonomyLegacyTest.php
@expectedDeprecation taxonomy_term_view() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term')->view() instead. Seeā€¦

File

core/modules/taxonomy/taxonomy.module, line 220

Code

function taxonomy_term_view_multiple(array $terms, $view_mode = 'full', $langcode = NULL) {
    @trigger_error("taxonomy_term_view_multiple() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal::entityTypeManager()->getViewBuilder('taxonomy_term')->viewMultiple() instead. See https://www.drupal.org/node/3033656", E_USER_DEPRECATED);
    return \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term')
        ->viewMultiple($terms, $view_mode, $langcode);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.