You are here

public function EntityReferenceFilterViewResult::query in Views Reference Filter 8

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides InOperator::query

File

src/Plugin/views/filter/EntityReferenceFilterViewResult.php, line 659

Class

EntityReferenceFilterViewResult
Filter by entity id using items got from the another view..

Namespace

Drupal\entityreference_filter\Plugin\views\filter

Code

public function query() {
  $exposed = $this
    ->isExposed();

  // Recalculate values if the filter is not exposed.
  if (!$exposed) {
    $options = $this
      ->getValueOptions();

    // If there are no filter options then add zero value item to ensure
    // there are no results.
    $values = !empty($options) ? array_keys($options) : [
      '0',
    ];
    $this->value = $values;
  }
  parent::query();
}