alinks.module in Alinks 8
Same filename and directory in other branches
Contains alinks.module.
File
alinks.moduleView source
<?php
/**
 * @file
 * Contains alinks.module.
 */
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
/**
 * Implements hook_entity_view().
 */
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',
      ];
    }
  }
}Functions
| Name   | Description | 
|---|---|
| alinks_entity_view | Implements hook_entity_view(). | 
