You are here

function search_api_entity_view in Search API 8

Implements hook_entity_view().

File

./search_api.module, line 646
Provides a rich framework for creating searches.

Code

function search_api_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  $excerpt_component = $display
    ->getComponent('search_api_excerpt');
  if ($excerpt_component !== NULL && isset($build['#search_api_excerpt'])) {
    $build['search_api_excerpt'] = [
      '#type' => 'markup',
      '#markup' => $build['#search_api_excerpt'],
      '#cache' => [
        'contexts' => [
          'url.query_args',
        ],
      ],
    ];
  }
}