You are here

trait ElasticsearchViewsHandlerTrait in Elasticsearch Connector 8.6

Same name and namespace in other branches
  1. 8.7 modules/elasticsearch_connector_views/src/Plugin/views/ElasticsearchViewsHandlerTrait.php \Drupal\elasticsearch_connector_views\Plugin\views\ElasticsearchViewsHandlerTrait
  2. 8.2 modules/elasticsearch_connector_views/src/Plugin/views/ElasticsearchViewsHandlerTrait.php \Drupal\elasticsearch_connector_views\Plugin\views\ElasticsearchViewsHandlerTrait
  3. 8.5 modules/elasticsearch_connector_views/src/Plugin/views/ElasticsearchViewsHandlerTrait.php \Drupal\elasticsearch_connector_views\Plugin\views\ElasticsearchViewsHandlerTrait

Provides a trait to use for Search API Views handlers.

Hierarchy

1 file declares its use of ElasticsearchViewsHandlerTrait
ElasticsearchViewsFieldTrait.php in modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsFieldTrait.php

File

modules/elasticsearch_connector_views/src/Plugin/views/ElasticsearchViewsHandlerTrait.php, line 8

Namespace

Drupal\elasticsearch_connector_views\Plugin\views
View source
trait ElasticsearchViewsHandlerTrait {

  /**
   * Overrides the Views handlers' ensureMyTable() method.
   *
   * This is done since adding a table to a Search API query is neither
   * necessary nor possible, but we still want to stay as compatible as possible
   * to the default SQL query plugin.
   */
  public function ensureMyTable() {
  }

  /**
   * Determines the entity type used by this handler.
   *
   * If this handler uses a relationship, the base class of the relationship is
   * taken into account.
   *
   * @return string
   *   The machine name of the entity type.
   *
   * @see \Drupal\views\Plugin\views\HandlerBase::getEntityType()
   */
  public function getEntityType() {
    if (isset($this->definition['entity_type'])) {
      return $this->definition['entity_type'];
    }
    return parent::getEntityType();
  }

  /**
   * Returns the active search index.
   *
   * @return string
   *   The index to use with this filter, or NULL if none could be
   *   loaded.
   */
  protected function getIndex() {

    // TODO: Implement.
    return NULL;
  }

  /**
   * Retrieves the query plugin.
   */
  public function getQuery() {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ElasticsearchViewsHandlerTrait::ensureMyTable public function Overrides the Views handlers' ensureMyTable() method.
ElasticsearchViewsHandlerTrait::getEntityType public function Determines the entity type used by this handler.
ElasticsearchViewsHandlerTrait::getIndex protected function Returns the active search index.
ElasticsearchViewsHandlerTrait::getQuery public function Retrieves the query plugin.