You are here

public function RouteEnhancer::enhance in Taxonomy Views Integrator 8

File

src/Enhancer/RouteEnhancer.php, line 44

Class

RouteEnhancer
Enhancer to set correct views defaults arguments for Term based on TVI.

Namespace

Drupal\tvi\Enhancer

Code

public function enhance(array $defaults, Request $request) {
  if (!empty($defaults['taxonomy_term']) && ($term = $defaults['taxonomy_term'])) {
    $term_view = $this->tviManager
      ->getTaxonomyTermViewAndDisplayId($term);
    $defaults['view_id'] = $term_view['view_id'];
    $defaults['display_id'] = $term_view['display_id'];
  }
  return $defaults;
}