You are here

function faq_ask_node_delete in FAQ_Ask 8

Same name and namespace in other branches
  1. 7 faq_ask.module \faq_ask_node_delete()

Handle deletion of questions.

Removes any pending answer notifications and term mappings for unpublished questions.

File

./faq_ask.module, line 388
This module is an add-on to FAQ module, allows users to 'ask question'.

Code

function faq_ask_node_delete($node) {
  if ($node
    ->getType() == 'faq') {

    // Remove notifications.
    \Drupal::database()
      ->delete('faq_ask_notify')
      ->condition('nid', $node
      ->id())
      ->execute();

    // Remove term/nid pairs.
    \Drupal::database()
      ->delete('faq_ask_term_index')
      ->condition('nid', $node
      ->id())
      ->execute();
  }
}