You are here

function search_api_solr_form_search_api_index_form_alter in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 search_api_solr.module \search_api_solr_form_search_api_index_form_alter()
  2. 8.2 search_api_solr.module \search_api_solr_form_search_api_index_form_alter()
  3. 4.x search_api_solr.module \search_api_solr_form_search_api_index_form_alter()

File

./search_api_solr.module, line 125
Provides a Solr-based service class for the Search API.

Code

function search_api_solr_form_search_api_index_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // We need to restrict by form ID here because this function is also called
  // via hook_form_BASE_FORM_ID_alter (which is wrong, e.g. in the case of the
  // form ID search_api_field_config).
  if (in_array($form_id, [
    'search_api_index_form',
    'search_api_index_edit_form',
  ]) && isset($form['server'])) {
    $form['server']['#element_validate'][] = 'search_api_solr_form_search_api_index_form_validate_server';
  }
}