You are here

function commerce_file_update_7109 in Commerce File 7

Ensure that a default is set for progammatically created fields

File

./commerce_file.install, line 408
Install, update and uninstall functions this module.

Code

function commerce_file_update_7109(&$sandbox) {
  field_info_cache_clear();
  drupal_load('module', 'commerce_file');
  $field_names = array(
    'commerce_file_license_file',
    'commerce_file_line_item_files',
  );
  foreach ($field_names as $field_name) {
    $field = field_info_field($field_name);
    if (!empty($field) && !empty($field['settings']) && empty($field['settings']['uri_scheme'])) {
      $field['settings']['uri_scheme'] = _commerce_file_default_system_scheme();
      field_update_field($field);
    }
  }
  return t('The Commerce File fields have been updated.');
}