You are here

public function SearchApiEtDatasourceController::getItemId in Search API Entity Translation 7.2

Retrieves the unique ID of an item.

Parameters

mixed $item: An item of this controller's type.

Return value

mixed Either the unique ID of the item, or NULL if none is available.

Throws

SearchApiDataSourceException If any error state was encountered.

Overrides SearchApiEntityDataSourceController::getItemId

File

includes/SearchApiEtDatasourceController.php, line 208
Contains the SearchApiEtDatasourceController class.

Class

SearchApiEtDatasourceController
Provides multilingual versions of all entity types.

Code

public function getItemId($item) {
  $entity_id = parent::getItemId($item);
  $translation_handler = entity_translation_get_handler($this->entityType, $item);
  $language = $translation_handler
    ->getLanguage();
  return $language ? SearchApiEtHelper::buildItemId($entity_id, $language) : $entity_id;
}