You are here

function elasticsearch_connector_cluster_load_all in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 elasticsearch_connector.module \elasticsearch_connector_cluster_load_all()
  2. 7.2 elasticsearch_connector.module \elasticsearch_connector_cluster_load_all()

Prepare list of all clusters by status.

Parameters

bool $active: Flag to return clusters with certain status.

bool $add_empty_option: Flag whether to add empty option to the list.

Return value

array An array of ElasticSearch connection cluster names, indexed by id.

3 calls to elasticsearch_connector_cluster_load_all()
SearchApiElasticsearchConnector::configurationForm in modules/elasticsearch_connector_search_api/service.inc
Overrides configurationForm().
_elasticsearch_connector_ec_clusters_process in ./elasticsearch_connector.module
Process the ec_cluster element type.
_elasticsearch_connector_ec_index_process in ./elasticsearch_connector.module
Build two dropdowns, one for the cluster and one for the indices.

File

./elasticsearch_connector.module, line 723
This module provide an interface to connecting to the elasticsearch cluster and implementing the official Elasticsearch library.

Code

function elasticsearch_connector_cluster_load_all($active = TRUE, $add_empty_option = FALSE) {
  $clusters = elasticsearch_connector_clusters($active);
  $options = array();
  if ($add_empty_option) {
    $options[''] = t('None');
  }
  foreach ($clusters as $cluster) {
    $options[$cluster->cluster_id] = $cluster->name;
  }
  return $options;
}