You are here

public function SearchApiFieldTrait::query in Search API 8

Add anything to the query that we might need to.

See also

\Drupal\views\Plugin\views\ViewsPluginInterface::query()

3 methods override SearchApiFieldTrait::query()
SearchApiEntity::query in src/Plugin/views/field/SearchApiEntity.php
Add anything to the query that we might need to.
SearchApiEntityField::query in src/Plugin/views/field/SearchApiEntityField.php
Add anything to the query that we might need to.
SearchApiRenderedItem::query in src/Plugin/views/field/SearchApiRenderedItem.php
Add anything to the query that we might need to.

File

src/Plugin/views/field/SearchApiFieldTrait.php, line 332

Class

SearchApiFieldTrait
Provides a trait to use for Search API Views field handlers.

Namespace

Drupal\search_api\Plugin\views\field

Code

public function query() {
  $combined_property_path = $this
    ->getCombinedPropertyPath();
  $field_id = NULL;
  if (!empty($this->definition['search_api field'])) {
    $field_id = $this->definition['search_api field'];
  }
  $this
    ->addRetrievedProperty($combined_property_path, $field_id);
  if ($this->options['link_to_item']) {

    // @todo We don't actually know which object we need, might be from this
    //   property or any of its parents – depending where the closest entity
    //   ancestor is. To be 100% accurate, we'd have to somehow already
    //   determine the correct property here.
    $this
      ->addRetrievedProperty("{$combined_property_path}:_object");
  }
}