You are here

function acquia_search_entity_operation_alter in Acquia Search 3.x

Same name and namespace in other branches
  1. 2.x acquia_search.module \acquia_search_entity_operation_alter()

Implements hook_entity_operation_alter().

Don't allow delete default server and index.

File

./acquia_search.module, line 24
Integration between Drupal and Acquia's hosted Solr search service.

Code

function acquia_search_entity_operation_alter(array &$operations, EntityInterface $entity) {
  if (empty($operations['delete'])) {
    return;
  }
  $do_not_delete = [
    'acquia_search_search_api_solr_server',
    'acquia_search_search_api_solr_index',
  ];
  if (array_search($entity
    ->id(), $do_not_delete) !== FALSE) {
    unset($operations['delete']);
  }
}