You are here

function heartbeat_entity_view in Heartbeat 8

Implements hook_entity_view().

File

./heartbeat.module, line 276
Contains heartbeat.module.

Code

function heartbeat_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
  if ($entity instanceof \Drupal\user\Entity\User) {
    if (isset($build['flag_friendship']) && \Drupal::currentUser()
      ->id() === $entity
      ->id()) {
      \Drupal::logger('heartbeat_friendship_entityView')
        ->debug('IDs are %id1 and %id2', array(
        '%id1' => \Drupal::currentUser()
          ->id(),
        '%id2' => $entity
          ->id(),
      ));
      unset($build['flag_friendship']);
    }
  }
}