You are here

function statistics_node_predelete in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_node_predelete()
  2. 9 core/modules/statistics/statistics.module \statistics_node_predelete()

Implements hook_ENTITY_TYPE_predelete() for node entities.

File

core/modules/statistics/statistics.module, line 82
Logs and displays content statistics for a site.

Code

function statistics_node_predelete(EntityInterface $node) {

  // Clean up statistics table when node is deleted.
  $id = $node
    ->id();
  return \Drupal::service('statistics.storage.node')
    ->deleteViews($id);
}