You are here

function _commerce_file_limit_element_value in Commerce File 7

FAPI value callback for limit element types.

2 calls to _commerce_file_limit_element_value()
commerce_file_limit_duration_element_value in includes/commerce_file.elements.inc
FAPI value callback for limit duration element type.
commerce_file_limit_integer_element_value in includes/commerce_file.elements.inc
FAPI value callback for limit textfield element type.

File

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

Code

function _commerce_file_limit_element_value($element, $input = FALSE, $form_state = array()) {
  if ($input !== FALSE) {
    return $input;
  }
  $return = array();
  $mode_options = _commerce_file_limit_element_get_mode_options($element);
  $default_value = isset($element['#default_value']) ? $element['#default_value'] : COMMERCE_FILE_LIMIT_UNLIMITED;
  if (is_scalar($default_value) && isset($mode_options[$default_value])) {
    $return['mode'] = $default_value;
    $return['value'] = '';
  }
  else {
    $return['mode'] = 'value';
    $return['value'] = $default_value;
  }
  return $return;
}