You are here

protected function SearchApiFieldTrait::isActiveForRow in Search API 8

Determines whether this field is active for the given row.

This is usually determined by the row's datasource.

Parameters

\Drupal\views\ResultRow $row: The result row.

Return value

bool TRUE if this field handler might produce output for the given row, FALSE otherwise.

1 call to SearchApiFieldTrait::isActiveForRow()
SearchApiFieldTrait::getValuesToExtract in src/Plugin/views/field/SearchApiFieldTrait.php
Determines and prepares the property values that need to be extracted.
1 method overrides SearchApiFieldTrait::isActiveForRow()
ViewsTestField::isActiveForRow in tests/src/Kernel/ViewsTestField.php
Determines whether this field is active for the given row.

File

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

Class

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

Namespace

Drupal\search_api\Plugin\views\field

Code

protected function isActiveForRow(ResultRow $row) {
  $datasource_ids = [
    NULL,
    $row->search_api_datasource,
  ];
  return in_array($this
    ->getDatasourceId(), $datasource_ids, TRUE);
}