function search_api_field_attach_rename_bundle in Search API 7
Implements hook_field_attach_rename_bundle().
This is implemented on behalf of the SearchApiEntityDataSourceController datasource controller, to update any bundle settings that contain the changed bundle.
File
- ./
search_api.module, line 989 - Provides a flexible framework for implementing search services.
Code
function search_api_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
foreach (search_api_index_load_multiple(FALSE, array(
'item_type' => $entity_type,
)) as $index) {
$bundles =& $index->options['datasource']['bundles'];
if (isset($bundles) && ($pos = array_search($bundle_old, $bundles)) !== FALSE) {
$bundles[$pos] = $bundle_new;
$index
->save();
// Clear all caches that could contain the bundle information.
$index
->resetCaches();
drupal_static_reset('search_api_get_datasource_controller');
}
}
}