protected function SearchApiEntityDataSourceController::getIndexBundles in Search API 7
Computes the bundles that should be indexed for an index.
Parameters
SearchApiIndex $index: The index for which to check.
Return value
array An array containing all bundles that should be included in this index, as both the keys and values. An empty array means all current bundles should be included.
Throws
SearchApiException If the index doesn't belong to this datasource controller.
4 calls to SearchApiEntityDataSourceController::getIndexBundles()
- SearchApiEntityDataSourceController::getConfigurationSummary in includes/
datasource_entity.inc - Returns a summary of an index's current datasource configuration.
- SearchApiEntityDataSourceController::startTracking in includes/
datasource_entity.inc - Initializes tracking of the index status of items for the given indexes.
- SearchApiEntityDataSourceController::startTrackingFallback in includes/
datasource_entity.inc - Initializes tracking of the index status of items for the given indexes.
- SearchApiEntityDataSourceController::trackItemInsert in includes/
datasource_entity.inc - Starts tracking the index status for the given items on the given indexes.
File
- includes/
datasource_entity.inc, line 344 - Contains the SearchApiEntityDataSourceController class.
Class
- SearchApiEntityDataSourceController
- Represents a datasource for all entities known to the Entity API.
Code
protected function getIndexBundles(SearchApiIndex $index) {
$this
->checkIndex($index);
if (!isset($this->bundles[$index->machine_name])) {
$this->bundles[$index->machine_name] = array();
if (!empty($index->options['datasource']['bundles'])) {
// We retrieve the available bundles here to check whether all of them
// are included by the index's setting. In this case, we return an empty
// array, too, to save on complexity.
// On the other hand, we still want to return deleted bundles since we
// do not want to suddenly include all bundles when all selected bundles
// were deleted.
$available = $this
->getAvailableBundles();
foreach ($index->options['datasource']['bundles'] as $bundle) {
$this->bundles[$index->machine_name][$bundle] = $bundle;
unset($available[$bundle]);
}
if (!$available) {
$this->bundles[$index->machine_name] = array();
}
}
}
return $this->bundles[$index->machine_name];
}