You are here

better_statistics.module in Better Statistics 8

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

File

better_statistics.module
View source
<?php

/**
 * @file
 * Contains better_statistics.module.
 */
use Drupal\Core\Entity\EntityInterface;

/**
 * Implements hook_entity_update().
 */
function better_statistics_entity_update(EntityInterface $entity) {
  $current_user = \Drupal::service('current_user');
  \Drupal::service('better_statistics.entity_interaction_collector')
    ->actionTypeTrigger($entity, $current_user, 'Update');
}

/**
 * Implements hook_entity_insert().
 */
function better_statistics_entity_insert(EntityInterface $entity) {
  $current_user = \Drupal::service('current_user');
  if ($entity
    ->getEntityTypeId() != 'sapi_data') {
    \Drupal::service('better_statistics.entity_interaction_collector')
      ->actionTypeTrigger($entity, $current_user, 'Create');
  }
}