You are here

function _commerce_file_license_resolve_setting_value in Commerce File 7

Resolves license settings values with inheritance of instance settings

2 calls to _commerce_file_license_resolve_setting_value()
_commerce_file_field_add_license_elements in includes/commerce_file.field.inc
License settings element generator
_commerce_file_license_resolve_settings in includes/commerce_file.field.inc
Resolve all settings for a given field item

File

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

Code

function _commerce_file_license_resolve_setting_value($value, $inherited_value) {
  if (!isset($value) || _commerce_file_field_setting_is_inherited($value)) {

    // check if inherited value is set to unlimited - blank textfields are unlimited
    if (!empty($inherited_value) || $inherited_value === '0') {
      return $inherited_value;
    }

    // default to unlimited
    return COMMERCE_FILE_FIELD_UNLIMITED;
  }
  return $value;
}