You are here

public static function SearchApiElasticsearchBackend::escapeName in Elasticsearch Connector 8

Helper function. Escape a field or index name.

Force names to be strictly alphanumeric-plus-underscore.

1 call to SearchApiElasticsearchBackend::escapeName()
SearchApiElasticsearchBackend::getIndexName in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Helper function. Returns the elasticsearch name of an index.

File

src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php, line 915
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 static function escapeName($name) {
  return preg_replace('/[^A-Za-z0-9_]+/', '', $name);
}