Skip to main content
added 20 characters in body
Source Link
Eyal
  • 3.3k
  • 16
  • 24

You can clear the cache tags of a specific view whenever a term is created.

function hook_inserthook_taxonomy_term_insert(EntityInterface $entity$term) {
  if ($entity$term->bundle() instanceof== TermInterface'VOCABULARY_ID') {
    Cache::invalidateTags(Views::load('view_name')->getCacheTags());
  }
}

You can clear the cache tags of a specific view whenever a term is created.

function hook_insert(EntityInterface $entity) {
  if ($entity instanceof TermInterface) {
    Cache::invalidateTags(Views::load('view_name')->getCacheTags());
  }
}

You can clear the cache tags of a specific view whenever a term is created.

function hook_taxonomy_term_insert(EntityInterface $term) {
  if ($term->bundle() == 'VOCABULARY_ID') {
    Cache::invalidateTags(Views::load('view_name')->getCacheTags());
  }
}
Source Link
Eyal
  • 3.3k
  • 16
  • 24

You can clear the cache tags of a specific view whenever a term is created.

function hook_insert(EntityInterface $entity) {
  if ($entity instanceof TermInterface) {
    Cache::invalidateTags(Views::load('view_name')->getCacheTags());
  }
}