You are here

public function DataTypeHelper::isTextType in Search API 8

Determines whether fields of the given type contain fulltext data.

Parameters

string $type: The type to check.

string[] $textTypes: (optional) An array of types to be considered as text.

Return value

bool TRUE if $type is one of the specified types, FALSE otherwise.

Overrides DataTypeHelperInterface::isTextType

File

src/Utility/DataTypeHelper.php, line 76

Class

DataTypeHelper
Provides helper methods for dealing with Search API data types.

Namespace

Drupal\search_api\Utility

Code

public function isTextType($type, array $textTypes = [
  'text',
]) {
  if (in_array($type, $textTypes)) {
    return TRUE;
  }
  $dataType = $this->dataTypeManager
    ->createInstance($type);
  if ($dataType && !$dataType
    ->isDefault()) {
    return in_array($dataType
      ->getFallbackType(), $textTypes);
  }
  return FALSE;
}