You are here

function search_api_field_update_field in Search API 7

Implements hook_field_update_field().

Recalculates fields settings if the cardinality of the field has changed from or to 1.

File

./search_api.module, line 1008
Provides a flexible framework for implementing search services.

Code

function search_api_field_update_field($field, $prior_field) {
  $before = $prior_field['cardinality'];
  $after = $field['cardinality'];
  if ($before != $after && ($before == 1 || $after == 1)) {

    // Unfortunately, we cannot call this right away since the field information
    // is only stored after the hook is called.
    drupal_register_shutdown_function('search_api_index_recalculate_fields');
  }
}