You are here

public function SearchApiElasticsearchConnector::configurationForm in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::configurationForm()
  2. 7 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::configurationForm()

Overrides configurationForm().

Overrides SearchApiAbstractService::configurationForm

1 call to SearchApiElasticsearchConnector::configurationForm()
SearchApiElasticsearchConnector::viewSettings in modules/elasticsearch_connector_search_api/service.inc
Overrides viewSettings().

File

modules/elasticsearch_connector_search_api/service.inc, line 77
Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.

Class

SearchApiElasticsearchConnector
Search service class.

Code

public function configurationForm(array $form, array &$form_state) {

  // Connector settings.
  $form['connector_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Elasticsearch connector settings'),
    '#tree' => FALSE,
  );
  $clusters = array(
    '' => t('Default cluster'),
  ) + elasticsearch_connector_cluster_load_all(TRUE);
  $form['connector_settings']['cluster'] = array(
    '#type' => 'select',
    '#title' => t('Cluster'),
    // This should not use the getCluster() method so that the service can be
    // configured to use the default cluster.
    '#default_value' => $this
      ->getOption('cluster', ''),
    '#options' => $clusters,
    '#description' => t('Select the cluster you want to handle the connections.'),
    '#parents' => array(
      'options',
      'form',
      'cluster',
    ),
  );

  // Facet settings.
  $form['facet_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Elasticsearch facet settings'),
    '#tree' => FALSE,
    '#access' => module_exists('search_api_facetapi'),
  );

  // Elasticsearch facet limit.
  $default = 10;
  $form['facet_settings']['facet_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Facet limit'),
    '#description' => t("Maximum number of facet elements to be returned by the server if 'no limit' is selected as hard limit is the facet option. Default is %default.", array(
      '%default' => $default,
    )),
    '#required' => TRUE,
    '#default_value' => $this
      ->getOption('facet_limit', $default),
    '#parents' => array(
      'options',
      'form',
      'facet_limit',
    ),
  );
  return $form;
}