You are here

public function Field::getOriginalType in Search API 8

Retrieves the original data type of this field.

This is the Drupal data type of the original property definition, which might not be a valid Search API data type. Instead it has to be a type that is recognized by \Drupal\Core\TypedData\TypedDataManager::createDataDefinition().

Return value

string The original data type.

Overrides FieldInterface::getOriginalType

File

src/Item/Field.php, line 569

Class

Field
Represents a field on a search item that can be indexed.

Namespace

Drupal\search_api\Item

Code

public function getOriginalType() {
  if (!isset($this->originalType)) {
    $this->originalType = 'string';
    try {
      $this->originalType = $this
        ->getDataDefinition()
        ->getDataType();
    } catch (SearchApiException $e) {
      $this
        ->logException($e);
    }
  }
  return $this->originalType;
}