You are here

function taxonomy_taxonomy_term_delete in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/taxonomy.module \taxonomy_taxonomy_term_delete()
  2. 7 modules/taxonomy/taxonomy.module \taxonomy_taxonomy_term_delete()

Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities.

Related topics

File

core/modules/taxonomy/taxonomy.module, line 387
Enables the organization of content into categories.

Code

function taxonomy_taxonomy_term_delete(Term $term) {
  if (\Drupal::config('taxonomy.settings')
    ->get('maintain_index_table')) {

    // Clean up the {taxonomy_index} table when terms are deleted.
    \Drupal::database()
      ->delete('taxonomy_index')
      ->condition('tid', $term
      ->id())
      ->execute();
  }
}