You are here

function taxonomy_term_view in Drupal 8

Same name and namespace in other branches
  1. 7 modules/taxonomy/taxonomy.module \taxonomy_term_view()

Generates an array which displays a term detail page.

Parameters

\Drupal\taxonomy\Entity\Term $term: A taxonomy term object.

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 A $page element suitable for use 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')->view() instead.

See also

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

1 call to taxonomy_term_view()
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 192
Enables the organization of content into categories.

Code

function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) {
  @trigger_error("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 https://www.drupal.org/node/3033656", E_USER_DEPRECATED);
  return \Drupal::entityTypeManager()
    ->getViewBuilder('taxonomy_term')
    ->view($term, $view_mode, $langcode);
}