function statistics_node_predelete

Same name in other branches
  1. 9 core/modules/statistics/statistics.module \statistics_node_predelete()
  2. 8.9.x core/modules/statistics/statistics.module \statistics_node_predelete()
  3. 10 core/modules/statistics/statistics.module \statistics_node_predelete()

Implements hook_ENTITY_TYPE_predelete() for node entities.

File

core/modules/statistics/statistics.module, line 84

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.