You are here

private function SpellCheck::getFilterMatch in Search API Spellcheck 8

Gets the matching filter for the suggestion.

Parameters

array $suggestion: The suggestion array.

Return value

bool|string False or the matching filter.

File

src/Plugin/views/area/SpellCheck.php, line 221

Class

SpellCheck
Provides an area for messages.

Namespace

Drupal\search_api_spellcheck\Plugin\views\area

Code

private function getFilterMatch(array $suggestion) {
  if ($index = array_search($suggestion[0], $this
    ->getFilters(), TRUE)) {

    // @todo: Better validation.
    if (!empty($suggestion[1]['suggestion'][0])) {
      return [
        $index => $suggestion[1]['suggestion'][0],
      ];
    }
  }
}