function TaxonomyHooks::taxonomyTermDelete

Implements hook_ENTITY_TYPE_delete() for taxonomy_term entities.

File

core/modules/taxonomy/src/Hook/TaxonomyHooks.php, line 171

Class

TaxonomyHooks
Hook implementations for taxonomy.

Namespace

Drupal\taxonomy\Hook

Code

public function taxonomyTermDelete(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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.