function forum_node_predelete

Same name in other branches
  1. 9 core/modules/forum/forum.module \forum_node_predelete()
  2. 8.9.x core/modules/forum/forum.module \forum_node_predelete()
  3. 11.x core/modules/forum/forum.module \forum_node_predelete()

Implements hook_ENTITY_TYPE_predelete() for node entities.

File

core/modules/forum/forum.module, line 246

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

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