You are here

function google_cse_entity_insert in Google Custom Search Engine 8.3

Implements hook_entity_insert().

Clear appropriate caches on storing Google CSE search plugin entity instance.

File

./google_cse.module, line 146
Display a Google Custom Search Engine (CSE) on your site.

Code

function google_cse_entity_insert(EntityInterface $entity) {
  if ($entity instanceof SearchPage) {
    $plugin = $entity
      ->getPlugin()
      ->getPluginId();
    if ($plugin == 'google_cse_search') {
      \Drupal::service('router.builder')
        ->rebuild();
    }
  }
}