You are here

function search_api_grouping_entity_update in Search API Grouping 7.2

Implements hook_entity_update().

Marks the item as changed for all indexes on entities of the specified type.

File

./search_api_grouping.module, line 116
Module search_api_grouping.

Code

function search_api_grouping_entity_update($entity, $type) {

  // We only react on entity operations for types with property information, as
  // we don't provide search integration for the others.
  if (!entity_get_property_info($type)) {
    return;
  }
  list($id) = entity_extract_ids($type, $entity);
  if (isset($id)) {

    // SearchApiDenormalizedEntityDataSourceController::trackItemChange()
    // accesses this static cache to ensure it uses the latest possible version
    // of the entity.
    $search_api_grouping_cache =& drupal_static('search_api_grouping_entity_op', array());
    $search_api_grouping_cache[$id] = clone $entity;
    search_api_track_item_change(search_api_grouping_get_type($type), array(
      $id,
    ));

    // Clear cache.
    $search_api_grouping_cache = array();
  }

  // If index immediately is enabled we've to convert the ids.
  _search_api_grouping_index_immediatley_hijack($type, array(
    $id,
  ));
}