You are here

function alinks_entity_view in Alinks 8

Implements hook_entity_view().

File

./alinks.module, line 14
Contains alinks.module.

Code

function alinks_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  $displays = Drupal::configFactory()
    ->get('alinks.settings')
    ->get('displays');
  $replacer = \Drupal::service('alinks.replacer');
  foreach ($displays as $display) {
    if ($entity
      ->getEntityTypeId() == $display['entity_type'] && $entity
      ->bundle() == $display['entity_bundle'] && $view_mode == $display['entity_display']) {
      $build['#post_render'][] = [
        get_class($replacer),
        'postRender',
      ];
    }
  }
}