You are here

function flexiform_update_7008 in Flexiform 7

Move targets for entity reference fields.

File

./flexiform.install, line 447
Sets up the base table for our entity and a table to store information about the entity types.

Code

function flexiform_update_7008() {
  if (!module_exists('entityreference')) {
    return;
  }
  foreach (field_read_fields(array(
    'type' => 'entityreference',
  )) as $field) {
    switch ($field['settings']['target_type']) {
      case 'flexiform_submission':
        $field['settings']['target_type'] = 'flexiform_webform_submission';
        break;
      case 'flexiform':
        $field['settings']['target_type'] = 'flexiform_webform';
        break;
      default:
        continue 2;
    }
    field_update_field($field);
  }
}