You are here

function _commerce_file_license_resolve_settings in Commerce File 7

Resolve all settings for a given field item

2 calls to _commerce_file_license_resolve_settings()
commerce_file_refresh_line_item in ./commerce_file.module
Refresh a line item with the current product license data
_commerce_file_field_aggregate_files in includes/commerce_file.field.inc
Return all commerce_file fields for a given entity, indexed by fid

File

includes/commerce_file.field.inc, line 716
Implement an commerce_file field, based on the file module's file field.

Code

function _commerce_file_license_resolve_settings($field_item, $instance) {
  if (empty($field_item['data']) || empty($instance['settings']['data'])) {
    return $field_item;
  }

  // get license setting info
  $license_info = _commerce_file_collate_license_info();

  // resolve only settings defined in license info
  foreach ($field_item['data'] as $setting_key => &$setting_value) {
    if (isset($license_info[$setting_key]) && isset($instance['settings']['data'][$setting_key])) {
      $setting_value = _commerce_file_license_resolve_setting_value($setting_value, $instance['settings']['data'][$setting_key]);
    }
  }
  unset($setting_value);
  return $field_item;
}