You are here

function search_api_autocomplete_view_delete in Search API Autocomplete 8

Implements hook_ENTITY_TYPE_delete() for type "view".

Clear the search plugin definitions cache when search views are deleted. Could use better support from the Plugin API – see #2633878.

File

./search_api_autocomplete.module, line 214
Adds autocomplete capabilities for Search API searches.

Code

function search_api_autocomplete_view_delete(ViewEntityInterface $view) {
  if (SearchApiQuery::getIndexFromTable($view
    ->get('base_table'))) {
    \Drupal::getContainer()
      ->get('plugin.manager.search_api_autocomplete.search')
      ->clearCachedDefinitions();
    SearchPluginDeriverBase::resetStaticDerivativeCaches('views');
  }
}