Community Documentation

hook_delete

5 node.php hook_delete(&$node)
6 node.php hook_delete(&$node)
7 node.api.php hook_delete($node)
8 node.api.php hook_delete($node)

Respond to node deletion.

This hook is invoked only on the module that defines the node's content type (use hook_node_delete() to respond to all node deletions).

This hook is invoked from node_delete_multiple() after the node has been removed from the node table in the database, before hook_node_delete() is invoked, and before field_attach_delete() is called.

Parameters

$node: The node that is being deleted.

Related topics

▾ 111 functions implement hook_delete()

actions_delete in includes/actions.inc
Deletes a single action from the database.
block_custom_block_delete in modules/block/block.admin.inc
Form constructor for the custom block deletion form.
block_menu_delete in modules/block/block.module
Implements hook_menu_delete().
block_user_role_delete in modules/block/block.module
Implements hook_user_role_delete().
book_node_delete in modules/book/book.module
Implements hook_node_delete().
comment_confirm_delete in modules/comment/comment.admin.inc
Form builder; Builds the confirmation form for deleting a single comment.
comment_delete in modules/comment/comment.module
Delete a comment and all its replies.
comment_node_delete in modules/comment/comment.module
Implements hook_node_delete().
comment_node_type_delete in modules/comment/comment.module
Implements hook_node_type_delete().
comment_user_delete in modules/comment/comment.module
Implements hook_user_delete().
DatabaseConnection::delete in includes/database/database.inc
Prepares and returns a DELETE query object.
DatabaseConnection_mysql::nextIdDelete in includes/database/mysql/database.inc
DatabaseDeleteTruncateTestCase::testSimpleDelete in modules/simpletest/tests/database_test.test
Confirm that we can delete a single record successfully.
DatabaseDeleteTruncateTestCase::testSubselectDelete in modules/simpletest/tests/database_test.test
Confirm that we can use a subselect in a delete successfully.
db_delete in includes/database/database.inc
Returns a new DeleteQuery object for the active database.
entity_crud_hook_test_comment_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_comment_delete().
entity_crud_hook_test_entity_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_entity_delete().
entity_crud_hook_test_file_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_file_delete().
entity_crud_hook_test_node_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_node_delete().
entity_crud_hook_test_taxonomy_term_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_taxonomy_term_delete().
entity_crud_hook_test_taxonomy_vocabulary_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_taxonomy_vocabulary_delete().
entity_crud_hook_test_user_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_user_delete().
FieldAttachStorageTestCase::testFieldAttachDelete in modules/field/tests/field.test
Test field_attach_delete().
field_attach_delete in modules/field/field.attach.inc
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_sql_storage_field_storage_delete in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_delete().
field_test_field_delete in modules/field/tests/field_test.field.inc
Implements hook_field_delete().
field_test_field_storage_delete in modules/field/tests/field_test.storage.inc
Implements hook_field_storage_delete().
file_delete in includes/file.inc
Delete a file and its database record.
file_field_delete in modules/file/file.field.inc
Implements hook_field_delete().
file_file_delete in modules/file/file.module
Implements hook_file_delete().
file_test_file_delete in modules/simpletest/tests/file_test.module
Implements hook_file_delete().
file_unmanaged_delete in includes/file.inc
Delete a file without calling any hooks or making any changes to the database.
file_usage_delete in includes/file.inc
Removes a record to indicate that a module is no longer using a file.
forum_comment_delete in modules/forum/forum.module
Implements hook_comment_delete().
forum_confirm_delete in modules/forum/forum.admin.inc
Returns a confirmation page for deleting a forum taxonomy term.
forum_node_delete in modules/forum/forum.module
Implements hook_node_delete().
forum_taxonomy_term_delete in modules/forum/forum.module
Implements hook_taxonomy_term_delete().
hook_actions_delete in modules/system/system.api.php
Executes code after an action is deleted.
hook_comment_delete in modules/comment/comment.api.php
The comment is being deleted by the moderator.
hook_entity_delete in modules/system/system.api.php
Act on entities when deleted.
hook_field_attach_delete in modules/field/field.api.php
Act on field_attach_delete().
hook_field_delete in modules/field/field.api.php
Define custom delete behavior for this module's field types.
hook_field_storage_delete in modules/field/field.api.php
Delete all field data for an entity.
hook_file_delete in modules/system/system.api.php
Respond to a file being deleted.
hook_image_style_delete in modules/image/image.api.php
Respond to image style deletion.
hook_menu_delete in modules/menu/menu.api.php
Informs modules that a custom menu was deleted.
hook_menu_link_delete in modules/system/system.api.php
Inform modules that a menu link has been deleted.
hook_node_delete in modules/node/node.api.php
Respond to node deletion.
hook_node_revision_delete in modules/node/node.api.php
Respond to deletion of a node revision.
hook_node_type_delete in modules/node/node.api.php
Respond to node type deletion.
hook_path_delete in modules/path/path.api.php
Allow modules to respond to a path being deleted.
hook_taxonomy_term_delete in modules/taxonomy/taxonomy.api.php
Respond to the deletion of taxonomy terms.
hook_taxonomy_vocabulary_delete in modules/taxonomy/taxonomy.api.php
Respond to the deletion of taxonomy vocabularies.
hook_user_delete in modules/user/user.api.php
Respond to user deletion.
hook_user_role_delete in modules/user/user.api.php
Inform other modules that a user role has been deleted.
image_effect_delete in modules/image/image.module
Delete an image effect.
image_field_delete in modules/image/image.field.inc
Implements hook_field_delete().
image_file_delete in modules/image/image.module
Implements hook_file_delete().
image_image_style_delete in modules/image/image.module
Implements hook_image_style_delete().
image_style_delete in modules/image/image.module
Delete an image style.
menu_delete in modules/menu/menu.module
Delete a custom menu and all contained links.
menu_link_delete in includes/menu.inc
Delete one or several menu links.
menu_node_delete in modules/menu/menu.module
Implements hook_node_delete().
menu_test_menu_link_delete in modules/simpletest/tests/menu_test.module
Implements hook_menu_link_delete().
node_access_test_node_delete in modules/node/tests/node_access_test.module
node_delete in modules/node/node.module
Delete a node.
node_revision_delete in modules/node/node.module
Delete a node revision.
node_type_delete in modules/node/node.module
Deletes a node type from the database.
node_user_delete in modules/node/node.module
Implements hook_user_delete().
OpenIDFunctionalTestCase::testDelete in modules/openid/openid.test
Test deleting an OpenID identity from a user's profile.
path_delete in includes/path.inc
Delete a URL alias.
path_node_delete in modules/path/path.module
Implements hook_node_delete().
path_taxonomy_term_delete in modules/path/path.module
Implements hook_taxonomy_term_delete().
poll_delete in modules/poll/poll.module
Implements hook_delete().
poll_user_delete in modules/poll/poll.module
Implements hook_user_delete().
profile_field_delete in modules/profile/profile.admin.inc
Menu callback; deletes a field from all user profiles.
profile_user_delete in modules/profile/profile.module
Implements hook_user_delete().
rdf_mapping_delete in modules/rdf/rdf.module
Deletes the mapping for the given bundle from the database.
search_comment_delete in modules/search/search.module
Implements hook_comment_delete().
ShortcutLinksTestCase::testShortcutLinkDelete in modules/shortcut/shortcut.test
Tests deleting a shortcut link.
ShortcutSetsTestCase::testShortcutSetDelete in modules/shortcut/shortcut.test
Tests deleting a shortcut set.
shortcut_link_delete in modules/shortcut/shortcut.admin.inc
Form callback: builds the confirmation form for deleting a shortcut link.
shortcut_set_delete in modules/shortcut/shortcut.module
Deletes a shortcut set.
statistics_node_delete in modules/statistics/statistics.module
Implements hook_node_delete().
statistics_user_delete in modules/statistics/statistics.module
Implements hook_user_delete().
system_date_format_delete in modules/system/system.module
Deletes a date format from the database.
system_date_format_type_delete in modules/system/system.module
Deletes a date type from the database.
system_ip_blocking_delete in modules/system/system.admin.inc
IP deletion confirm page.
TaxonomyTermUnitTest::testTermDelete in modules/taxonomy/taxonomy.test
taxonomy_node_delete in modules/taxonomy/taxonomy.module
Implements hook_node_delete().
taxonomy_taxonomy_term_delete in modules/taxonomy/taxonomy.module
Implements hook_taxonomy_term_delete().
taxonomy_term_confirm_delete in modules/taxonomy/taxonomy.admin.inc
Form builder for the term delete form.
taxonomy_term_delete in modules/taxonomy/taxonomy.module
Delete a term.
taxonomy_test_taxonomy_term_delete in modules/simpletest/tests/taxonomy_test.module
Implements hook_taxonomy_term_delete().
taxonomy_vocabulary_confirm_delete in modules/taxonomy/taxonomy.admin.inc
Form builder for the vocabulary delete confirmation form.
taxonomy_vocabulary_delete in modules/taxonomy/taxonomy.module
Delete a vocabulary.
tracker_comment_delete in modules/tracker/tracker.module
Implements hook_comment_delete().
tracker_node_delete in modules/tracker/tracker.module
Implements hook_node_delete().
Translation editing/deletion interface in modules/locale/locale.admin.inc
Edit and delete translation strings.
translation_node_delete in modules/translation/translation.module
Implements hook_node_delete().
trigger_actions_delete in modules/trigger/trigger.module
Implements hook_actions_delete().
trigger_comment_delete in modules/trigger/trigger.module
Implements hook_comment_delete().
trigger_node_delete in modules/trigger/trigger.module
Implements hook_node_delete().
trigger_taxonomy_term_delete in modules/trigger/trigger.module
Implements hook_taxonomy_term_delete().
trigger_user_delete in modules/trigger/trigger.module
Implements hook_user_delete().
UserCancelTestCase::testUserDelete in modules/user/user.test
Delete account and remove all content.
user_cookie_delete in modules/user/user.module
Delete a visitor information cookie.
user_delete in modules/user/user.module
Delete a user.
user_file_delete in modules/user/user.module
Implements hook_file_delete().
user_image_style_delete in modules/user/user.module
Implements hook_image_style_delete().
user_role_delete in modules/user/user.module
Delete a user role from database.

File

modules/node/node.api.php, line 1027
Hooks provided by the Node module.

Code

<?php
function hook_delete($node) {
  db_delete('mytable')
    ->condition('nid', $node->nid)
    ->execute();
}
?>
Login or register to post comments