You are here

function field_collection_table_update_7001 in Field Collection Table 7

Updates FCT Field Instances with new formatter settings.

File

./field_collection_table.install, line 19
Install, update and uninstall functions for the Field Collection Table module.

Code

function field_collection_table_update_7001() {
  foreach (field_info_instances() as $entity_type => $entity) {
    foreach ($entity as $entity_name => $info) {
      foreach ($info as $field_name => $instance) {
        if (!empty($instance['widget']['type']) && $instance['widget']['type'] == 'field_collection_table') {
          if (isset($instance['widget']['settings']['title_on_top'])) {
            $instance['widget']['settings']['hide_title'] = !$instance['widget']['settings']['title_on_top'];
            unset($instance['widget']['settings']['title_on_top']);
          }
          field_update_instance($instance);
        }
      }
    }
  }
}