public function SearchApiEntityDataSourceController::trackItemInsert in Search API 7
Starts tracking the index status for the given items on the given indexes.
Parameters
array $item_ids: The IDs of new items to track.
SearchApiIndex[] $indexes: The indexes for which items should be tracked.
Return value
SearchApiIndex[]|null All indexes for which any items were added; or NULL if items were added for all of them.
Throws
SearchApiDataSourceException If any error state was encountered.
Overrides SearchApiAbstractDataSourceController::trackItemInsert
1 call to SearchApiEntityDataSourceController::trackItemInsert()
- SearchApiEntityDataSourceController::startTrackingFallback in includes/
datasource_entity.inc - Initializes tracking of the index status of items for the given indexes.
File
- includes/
datasource_entity.inc, line 248 - Contains the SearchApiEntityDataSourceController class.
Class
- SearchApiEntityDataSourceController
- Represents a datasource for all entities known to the Entity API.
Code
public function trackItemInsert(array $item_ids, array $indexes) {
$ret = array();
foreach ($indexes as $index_id => $index) {
$ids = $item_ids;
if ($bundles = $this
->getIndexBundles($index)) {
$ids = drupal_map_assoc($ids);
foreach (entity_load($this->entityType, $ids) as $id => $entity) {
if (empty($bundles[$entity->{$this->bundleKey}])) {
unset($ids[$id]);
}
}
}
if ($ids) {
parent::trackItemInsert($ids, array(
$index,
));
$ret[$index_id] = $index;
}
}
return $ret;
}