You are here

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

Parameters

$item_ids array|string:

$indexes SearchApiIndex[]:

$dequeue bool:

Overrides SearchApiAbstractDataSourceController::trackItemChange

File

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

Class

SearchApiEtDatasourceController
Provides multilingual versions of all entity types.

Code

public function trackItemChange($item_ids, array $indexes, $dequeue = FALSE) {

  // If this method was called from _search_api_index_reindex(), $item_ids
  // will be set to FALSE, which means we need to reindex all items, so no
  // need for any other processing below.
  if ($item_ids === FALSE) {
    parent::trackItemChange($item_ids, $indexes, $dequeue);
    return NULL;
  }
  $ret = array();
  foreach ($indexes as $index_id => $index) {

    // The $item_ids can contain a single EntityID if we get invoked from the
    // hook: search_api_et_entity_update(). In this case we need to, for each
    // Index, identify the set of ItemIDs that need to be marked as changed.
    // Check if we get Entity IDs or Item IDs.
    $ids = $this
      ->filterTrackableIds($index, $item_ids);
    if (!empty($ids)) {
      parent::trackItemChange($ids, array(
        $index,
      ), $dequeue);
      $ret[$index_id] = $index;
    }
  }
  return $ret;
}