You are here

function range_field_formatter_info in Range 7

Same name and namespace in other branches
  1. 6 range.module \range_field_formatter_info()

Implements hook_field_formatter_info().

File

./range.module, line 257
Defines range field types.

Code

function range_field_formatter_info() {
  $base_settings = array(
    'range_combine' => FALSE,
    'range_separator' => '-',
    'from_prefix_suffix' => TRUE,
    'to_prefix_suffix' => TRUE,
    'field_prefix_suffix' => TRUE,
    'combined_prefix_suffix' => FALSE,
  );
  $base_number_format_settings = array(
    'thousand_separator' => ' ',
    'decimal_separator' => '.',
  );
  return array(
    'range_integer' => array(
      'label' => t('Default'),
      'field types' => array(
        'range_integer',
      ),
      'settings' => $base_settings + $base_number_format_settings + array(
        'scale' => 0,
      ),
    ),
    'range_decimal' => array(
      'label' => t('Default'),
      'field types' => array(
        'range_decimal',
        'range_float',
      ),
      'settings' => $base_settings + $base_number_format_settings + array(
        'scale' => 2,
      ),
    ),
    'range_integer_sprintf' => array(
      'label' => t('Formatted string'),
      'field types' => array(
        'range_integer',
      ),
      'settings' => $base_settings + array(
        'format_string' => '%d',
      ),
    ),
    'range_decimal_sprintf' => array(
      'label' => t('Formatted string'),
      'field types' => array(
        'range_decimal',
        'range_float',
      ),
      'settings' => $base_settings + array(
        'format_string' => '%.2f',
      ),
    ),
    'range_unformatted' => array(
      'label' => t('Unformatted'),
      'field types' => array(
        'range_integer',
        'range_decimal',
        'range_float',
      ),
      'settings' => $base_settings,
    ),
  );
}