1 taxonomy.entity.inc public TaxonomyTermController::view($terms, $view_mode = 'full', $langcode = NULL, $page = NULL)

Overrides DefaultEntityController::view().

Overrides DefaultEntityController::view

File

core/modules/taxonomy/taxonomy.entity.inc, line 352
Entity classes and controllers for Taxonomy module.

Class

TaxonomyTermController
Controller class for taxonomy terms.

Code

public function view($terms, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  global $language_content;
  $langcode = $langcode ? $langcode : $language_content->langcode;

  $view = array();
  foreach ($terms as $term) {
    /* @var TaxonomyTerm $term */
    // Populate $term->content with a render() array.
    $this->buildContent($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,
      '#page' => $page,
    );

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

    // Allow modules to modify the structured taxonomy term.
    $type = 'taxonomy_term';
    backdrop_alter(array('taxonomy_term_view', 'entity_view'), $build, $type);
    $view[$type][$term->id()] = $build;
  }

  return $view;
}