function hook_taxonomy_term_predelete

Act before taxonomy term deletion.

This hook is invoked from taxonomy term deletion before field_attach_delete() is called and before the term is actually removed from the database.

Parameters

Drupal\taxonomy\Term $term: The taxonomy term entity that is about to be deleted.

Related topics

1 function implements hook_taxonomy_term_predelete()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_taxonomy_term_predelete in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_taxonomy_term_predelete().

File

drupal/core/modules/taxonomy/taxonomy.api.php, line 227
Hooks provided by the Taxonomy module.

Code

function hook_taxonomy_term_predelete(Drupal\taxonomy\Term $term) {
  db_delete('mytable_index')
    ->condition('tid', $term
    ->id())
    ->execute();
}