You are here

function forum_node_predelete in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/forum/forum.module \forum_node_predelete()

Implements hook_ENTITY_TYPE_predelete() for node entities.

File

core/modules/forum/forum.module, line 232
Provides discussion forums.

Code

function forum_node_predelete(EntityInterface $node) {
  if (\Drupal::service('forum_manager')
    ->checkNodeType($node)) {

    /** @var \Drupal\forum\ForumIndexStorageInterface $forum_index_storage */
    $forum_index_storage = \Drupal::service('forum.index_storage');
    $forum_index_storage
      ->delete($node);
    $forum_index_storage
      ->deleteIndex($node);
  }
}