You are here

function _commerce_file_limit_element_get_mode_options in Commerce File 7

Return keyed array of limit mode options

3 calls to _commerce_file_limit_element_get_mode_options()
commerce_file_limit_duration_element_process in includes/commerce_file.elements.inc
FAPI process callback for limit textfield element type.
commerce_file_limit_integer_element_process in includes/commerce_file.elements.inc
FAPI process callback for limit textfield element type.
_commerce_file_limit_element_value in includes/commerce_file.elements.inc
FAPI value callback for limit element types.

File

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

Code

function _commerce_file_limit_element_get_mode_options($element, $inherited_format_callback = '') {
  $options = array(
    COMMERCE_FILE_LIMIT_UNLIMITED => t('Unlimited'),
    'value' => t('Custom value'),
  );

  // prepend inherited option
  if (isset($element['#limit_inherited_value'])) {
    $inherited_value = $element['#limit_inherited_value'];
    if (!empty($inherited_format_callback)) {
      $inherited_value = $inherited_format_callback($inherited_value);
    }
    $options = array(
      COMMERCE_FILE_LIMIT_INHERITED => t('Inherited (@inherited)', array(
        '@inherited' => $inherited_value,
      )),
    ) + $options;
  }
  return $options;
}