You are here

protected function DidYouMeanSpellCheck::getFilterFieldKey in Search API Spellcheck 8.3

Gets the filter field key for the current view. Having multiple full text search filters are currently not supported.

Return value

string The filter field key.

2 calls to DidYouMeanSpellCheck::getFilterFieldKey()
DidYouMeanSpellCheck::render in src/Plugin/views/area/DidYouMeanSpellCheck.php
Render the area.
SuggestionsSpellCheck::render in src/Plugin/views/area/SuggestionsSpellCheck.php
Render the area.

File

src/Plugin/views/area/DidYouMeanSpellCheck.php, line 146

Class

DidYouMeanSpellCheck
Provides an area for messages.

Namespace

Drupal\search_api_spellcheck\Plugin\views\area

Code

protected function getFilterFieldKey() {
  $field_key = null;
  $filters = $this->view->filter;
  foreach ($filters as $filter) {
    if (!isset($field_key)) {
      if ($filter instanceof SearchApiFulltext && $filter
        ->isExposed()) {
        $exposed_info = $filter
          ->exposedInfo();
        $field_key = $exposed_info['value'];
      }
    }
  }
  return $field_key;
}