You are here

protected function SearchApiFulltext::getFulltextFields in Search API 8

Same name in this branch
  1. 8 src/Plugin/views/filter/SearchApiFulltext.php \Drupal\search_api\Plugin\views\filter\SearchApiFulltext::getFulltextFields()
  2. 8 src/Plugin/views/argument/SearchApiFulltext.php \Drupal\search_api\Plugin\views\argument\SearchApiFulltext::getFulltextFields()

Retrieves an options list of available fulltext fields.

Return value

string[] An associative array mapping the identifiers of the index's fulltext fields to their prefixed labels.

1 call to SearchApiFulltext::getFulltextFields()
SearchApiFulltext::buildOptionsForm in src/Plugin/views/argument/SearchApiFulltext.php
Build the options form.

File

src/Plugin/views/argument/SearchApiFulltext.php, line 170

Class

SearchApiFulltext
Defines a contextual filter for doing fulltext searches.

Namespace

Drupal\search_api\Plugin\views\argument

Code

protected function getFulltextFields() {
  $fields = [];
  if (!empty($this->query)) {
    $index = $this->query
      ->getIndex();
  }
  else {
    $index = SearchApiQuery::getIndexFromTable($this->table);
  }
  if (!$index) {
    return [];
  }
  $fields_info = $index
    ->getFields();
  foreach ($index
    ->getFulltextFields() as $field_id) {
    $fields[$field_id] = $fields_info[$field_id]
      ->getPrefixedLabel();
  }
  return $fields;
}