You are here

function acquia_search_form_search_api_server_status_alter in Acquia Connector 8

Implements hook_form_FORM_ID_alter().

Alters the Search API server's status form and displays a warning.

File

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

Code

function acquia_search_form_search_api_server_status_alter(&$form) {
  $server = !empty($form['#server']) ? $form['#server'] : NULL;
  if (!is_object($server) || get_class($server) !== 'Drupal\\search_api\\Entity\\Server') {
    return;
  }
  if (!acquia_search_is_acquia_server($server
    ->getBackendConfig())) {
    return;
  }
  if (!acquia_search_should_set_read_only_mode()) {
    return;
  }

  // Show read-only warning and disable the "Delete all indexed
  // data on this server" action.
  acquia_search_server_show_read_only_mode_warning();
  $form['actions']['clear']['#disabled'] = TRUE;
}