You are here

protected function SearchApiElasticsearchBackend::viewSettingElement in Elasticsearch Connector 8

Helper function. Display a setting element.

File

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

protected function viewSettingElement($element) {
  $output = '';
  if (is_array($element['option'])) {
    $value = '';
    foreach ($element['option'] as $sub_element) {
      $value .= $this
        ->viewSettingElement($sub_element);
    }
  }
  else {
    $value = $this
      ->getOption($element['option']);
    $value = nl2br(String::checkPlain(print_r($value, TRUE)));
  }
  $output .= '<dt><em>' . String::checkPlain($element['label']) . '</em></dt>' . "\n";
  $output .= '<dd>' . $value . '</dd>' . "\n";
  return "<dl>\n{$output}</dl>";
}