You are here

TermViewBuilder.php in Zircon Profile 8.0

Same filename and directory in other branches
  1. 8 core/modules/taxonomy/src/TermViewBuilder.php

Namespace

Drupal\taxonomy

File

core/modules/taxonomy/src/TermViewBuilder.php
View source
<?php

/**
 * @file
 * Contains \Drupal\taxonomy\TermViewBuilder.
 */
namespace Drupal\taxonomy;

use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;

/**
 * Render controller for taxonomy terms.
 */
class TermViewBuilder extends EntityViewBuilder {

  /**
   * {@inheritdoc}
   */
  protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
    parent::alterBuild($build, $entity, $display, $view_mode);
    $build['#contextual_links']['taxonomy_term'] = array(
      'route_parameters' => array(
        'taxonomy_term' => $entity
          ->id(),
      ),
      'metadata' => array(
        'changed' => $entity
          ->getChangedTime(),
      ),
    );
  }

}

Classes

Namesort descending Description
TermViewBuilder Render controller for taxonomy terms.