You are here

alinks.module in Alinks 8

Same filename and directory in other branches
  1. 6 alinks.module
  2. 7 alinks.module

Contains alinks.module.

File

alinks.module
View 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

Namesort descending Description
alinks_entity_view Implements hook_entity_view().