function webform_node_delete in Webform 7.3
Same name and namespace in other branches
- 6.3 webform.module \webform_node_delete()
- 7.4 webform.module \webform_node_delete()
Implements hook_node_delete().
1 call to webform_node_delete()
- webform_check_record in ./
webform.module - Utility function to check if a webform record is necessary in the database.
File
- ./
webform.module, line 1264 - This module provides a simple way to create forms and questionnaires.
Code
function webform_node_delete($node) {
if (!in_array($node->type, webform_variable_get('webform_node_types'))) {
return;
}
// Allow components clean up extra data, such as uploaded files.
module_load_include('inc', 'webform', 'includes/webform.components');
foreach ($node->webform['components'] as $cid => $component) {
webform_component_delete($node, $component);
}
// Remove any trace of webform data from the database.
db_delete('webform')
->condition('nid', $node->nid)
->execute();
db_delete('webform_component')
->condition('nid', $node->nid)
->execute();
db_delete('webform_emails')
->condition('nid', $node->nid)
->execute();
db_delete('webform_roles')
->condition('nid', $node->nid)
->execute();
db_delete('webform_submissions')
->condition('nid', $node->nid)
->execute();
db_delete('webform_submitted_data')
->condition('nid', $node->nid)
->execute();
db_delete('webform_last_download')
->condition('nid', $node->nid)
->execute();
}