You are here

public static function SuggestionHelper::getStops in Autocomplete Search Suggestions 7

Stopword get wrapper.

Return value

mixed The value of the supplied field.

2 calls to SuggestionHelper::getStops()
SuggestionHelper::atomize in src/SuggestionHelper.php
Transform a string to an array.
suggestion_admin_settings_form in ./suggestion.admin.inc
Menu callback to configure suggestion settings.

File

src/SuggestionHelper.php, line 106
Helper methods for the suggestion module.

Class

SuggestionHelper
Provides helper methods for suggestions.

Code

public static function getStops() {
  $stopwords =& drupal_static(__CLASS__ . '_' . __FUNCTION__, NULL);
  if (is_array($stopwords)) {
    return $stopwords;
  }
  $file_path = drupal_realpath(variable_get('suggestion_stopword_uri', file_default_scheme() . '://suggestion/suggestion_stopword.txt'));
  $stopwords = file_get_contents($file_path);
  $stopwords = array_fill_keys(preg_split('/\\s*[\\n\\r]+\\s*/s', $stopwords), 1);
  return $stopwords;
}