public function SearchApiElasticsearchBackend::buildConfigurationForm in Elasticsearch Connector 8.2
Same name and namespace in other branches
- 8.7 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::buildConfigurationForm()
- 8 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::buildConfigurationForm()
- 8.5 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::buildConfigurationForm()
- 8.6 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::buildConfigurationForm()
File
- src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php, line 155 - Contains the SearchApiElasticsearchBackend object.
Class
- SearchApiElasticsearchBackend
- Plugin annotation @SearchApiBackend( id = "elasticsearch", label = @Translation("Elasticsearch"), description = @Translation("Index items using an Elasticsearch server.") )
Namespace
Drupal\elasticsearch_connector\Plugin\search_api\backendCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
if (!$this->server
->isNew()) {
$server_link = $this->cluster
->getSafeUrl();
// Editing this server.
$form['server_description'] = [
'#type' => 'item',
'#title' => $this
->t('Elasticsearch Cluster'),
'#description' => Link::fromTextAndUrl($server_link, Url::fromUri($server_link)),
];
}
$form['cluster_settings'] = [
'#type' => 'fieldset',
'#title' => t('Elasticsearch settings'),
];
// We are not displaying disabled clusters.
$clusters = Cluster::loadAllClusters(FALSE);
$options = [];
foreach ($clusters as $key => $cluster) {
$options[$key] = $cluster->cluster_id;
}
$options[Cluster::getDefaultCluster()] = t('Default cluster: ' . Cluster::getDefaultCluster());
$form['cluster_settings']['cluster'] = [
'#type' => 'select',
'#title' => t('Cluster'),
'#required' => TRUE,
'#options' => $options,
'#default_value' => $this->configuration['cluster_settings']['cluster'] ? $this->configuration['cluster_settings']['cluster'] : '',
'#description' => t('Select the cluster you want to handle the connections.'),
];
return $form;
}