You are here

public static function SuggestionHelper::types in Autocomplete Search Suggestions 8.2

Same name and namespace in other branches
  1. 8 src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::types()
  2. 3.0.x src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::types()

Build an array of content types used in auto-complete.

Return value

array An array of enabled content types.

3 calls to SuggestionHelper::types()
SuggestionStorage::getScore in src/SuggestionStorage.php
Calculate a suggestion's score.
SuggestionStorage::getTitles in src/SuggestionStorage.php
Fetch an array of node titles.
suggestion_node_insert in ./suggestion.module
Implements hook_node_insert().

File

src/SuggestionHelper.php, line 361

Class

SuggestionHelper
Provides helper methods for suggestions.

Namespace

Drupal\suggestion

Code

public static function types() {
  $types =& drupal_static(__CLASS__ . '_' . __FUNCTION__, NULL);
  if (is_array($types)) {
    return $types;
  }
  foreach (self::getConfig('types') as $type => $status) {
    if ($status) {
      $types[] = $type;
    }
  }
  return $types ? $types : [];
}