You are here

public function SearchApiElasticsearchBackend::getServerLink in Elasticsearch Connector 8

Returns a link to the Elasticsearch server, if the necessary options are set.

2 calls to SearchApiElasticsearchBackend::getServerLink()
SearchApiElasticsearchBackend::buildConfigurationForm in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Overrides configurationForm().
SearchApiElasticsearchBackend::viewSettings in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Overrides viewSettings().

File

src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php, line 266
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\backend

Code

public function getServerLink() {
  if (!$this->configuration) {
    return '';
  }
  $host = $this->configuration['host'];
  if ($host == 'localhost' && !empty($_SERVER['SERVER_NAME'])) {
    $host = $_SERVER['SERVER_NAME'];
  }
  $url = $this->configuration['scheme'] . '://' . $host . ':' . $this->configuration['port'] . $this->configuration['path'];
  return $url;
}