function answers_node_delete in Answers 7.4
Same name and namespace in other branches
- 7 answers.module \answers_node_delete()
- 7.2 answers.module \answers_node_delete()
- 7.3 answers.module \answers_node_delete()
Implements hook_node_delete().
Delete answers of some question when this one is deleted. On cascade.
TODO: This is going to be obsolete (hopefully) when the patch been worked in: http://drupal.org/node/1368386 is commited to entityreference
File
- ./
answers.module, line 422 - The Answers module.
Code
function answers_node_delete($node) {
if ($node->type == 'answers_question') {
$nids = db_query('SELECT entity_id FROM {field_data_answers_related_question} WHERE answers_related_question_target_id = :nid', array(
':nid' => $node->nid,
))
->fetchCol();
node_delete_multiple($nids);
}
}