You are here

function _multifield_update_field_schemas in Multifield 7

Same name and namespace in other branches
  1. 7.2 multifield.module \_multifield_update_field_schemas()
3 calls to _multifield_update_field_schemas()
multifield_field_create_instance in ./multifield.module
Implements hook_field_create_instance().
multifield_field_delete_instance in ./multifield.module
Implements hook_field_delete_instance().
multifield_field_update_instance in ./multifield.module
Implements hook_field_update_instance().

File

./multifield.module, line 384

Code

function _multifield_update_field_schemas($machine_name) {
  foreach (multifield_type_get_fields($machine_name) as $field_name) {
    $field = field_read_field($field_name);
    if (!field_has_data($field)) {

      // Drupal core keeps existing, but should-be-removed indexes still in
      // the $field['indexes'] array. This is a hack to get it to always read
      // the indexes from multifield_field_schema().
      // @see https://www.drupal.org/node/2311095
      $field['indexes'] = array();
      field_update_field($field);
    }
  }
}