You are here

public function ElasticsearchViewsEntityField::query in Elasticsearch Connector 8.7

Same name and namespace in other branches
  1. 8.2 modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntityField.php \Drupal\elasticsearch_connector_views\Plugin\views\field\ElasticsearchViewsEntityField::query()
  2. 8.5 modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntityField.php \Drupal\elasticsearch_connector_views\Plugin\views\field\ElasticsearchViewsEntityField::query()
  3. 8.6 modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntityField.php \Drupal\elasticsearch_connector_views\Plugin\views\field\ElasticsearchViewsEntityField::query()

Called to add the field to a query.

By default, all needed data is taken from entities loaded by the query plugin. Columns are added only if they are used in groupings.

Overrides EntityField::query

File

modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntityField.php, line 59

Class

ElasticsearchViewsEntityField
Displays entity field data.

Namespace

Drupal\elasticsearch_connector_views\Plugin\views\field

Code

public function query($use_groupby = false) {

  // If we're not using Field API field rendering, just use the query()
  // implementation of the fallback handler.
  if (!$this->options['field_rendering']) {
    $this->fallbackHandler
      ->query();
    return;
  }

  // If we do use Field API rendering, we need the entity object for the
  // parent property.
  $parent_path = $this
    ->getParentPath();
  $property_path = $parent_path ? "{$parent_path}:_object" : '_object';
  $combined_property_path = Utility::createCombinedId($this
    ->getDatasourceId(), $property_path);
  $this
    ->addRetrievedProperty($combined_property_path);
}