You are here

function _commerce_file_limit_duration_element_greatest_unit in Commerce File 7

Returns the greatest unit multiplier that yields an integer value

1 call to _commerce_file_limit_duration_element_greatest_unit()
_commerce_file_limit_duration_element_explode_value in includes/commerce_file.elements.inc
Returns an array of scalar value, greatest unit multiplier

File

includes/commerce_file.elements.inc, line 338
Commerce File form elements

Code

function _commerce_file_limit_duration_element_greatest_unit($value) {
  $units = _commerce_file_limit_duration_element_units();
  foreach ($units as $multiplier => $label) {
    if ($multiplier && $value % $multiplier == 0) {
      return $multiplier;
    }
  }

  // fallback to seconds
  return 1;
}