You are here

function acquia_search_entity_operation_alter in Acquia Connector 8

Implements hook_entity_operation_alter().

Don't allow delete default server and index.

File

acquia_search/acquia_search.module, line 107
Integration between Acquia 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_server',
    'acquia_search_index',
  ];
  if (array_search($entity
    ->id(), $do_not_delete) !== FALSE) {
    unset($operations['delete']);
  }
}