function taxonomy_term_view

7.x taxonomy.module taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL)

Generate an array for rendering the given term.

Parameters

$term: A term object.

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

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

Return value

An array as expected by drupal_render().

2 calls to taxonomy_term_view()
taxonomy_term_page in drupal/modules/taxonomy/taxonomy.pages.inc
Menu callback; displays all nodes associated with a term.
taxonomy_term_view_multiple in drupal/modules/taxonomy/taxonomy.module
Constructs a drupal_render() style array from an array of loaded terms.
1 string reference to 'taxonomy_term_view'
taxonomy_term_build_content in drupal/modules/taxonomy/taxonomy.module
Builds a structured array representing the term's content.

File

drupal/modules/taxonomy/taxonomy.module, line 867
Enables the organization of content into categories.

Code

function taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;
  }

  // Populate $term->content with a render() array.
  taxonomy_term_build_content($term, $view_mode, $langcode);
  $build = $term->content;

  // We don't need duplicate rendering info in $term->content.
  unset($term->content);

  $build += array(
    '#theme' => 'taxonomy_term',
    '#term' => $term,
    '#view_mode' => $view_mode,
    '#language' => $langcode,
  );

  $build['#attached']['css'][] = drupal_get_path('module', 'taxonomy') . '/taxonomy.css';

  // Allow modules to modify the structured taxonomy term.
  $type = 'taxonomy_term';
  drupal_alter(array('taxonomy_term_view', 'entity_view'), $build, $type);

  return $build;
}