You are here

function range_field_info in Range 7

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

Implements hook_field_info().

File

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

Code

function range_field_info() {
  $instance_settings = array(
    'min' => '',
    'max' => '',
    'field' => array(
      'prefix' => '',
      'suffix' => '',
    ),
    'from' => array(
      'label' => t('From'),
      'prefix' => '',
      'suffix' => '',
    ),
    'to' => array(
      'label' => t('to'),
      'prefix' => '',
      'suffix' => '',
    ),
    'combined' => array(
      'prefix' => '',
      'suffix' => '',
    ),
  );
  return array(
    'range_integer' => array(
      'label' => t('Range: integer'),
      'description' => t('This field stores a range in the database as an integer.'),
      'instance_settings' => $instance_settings,
      'default_widget' => 'range',
      'default_formatter' => 'range_integer',
      'property_type' => 'field_item_range',
      'property_callbacks' => array(
        'range_metadata_field_range_callback',
      ),
    ),
    'range_decimal' => array(
      'label' => t('Range: decimal'),
      'description' => t('This field stores a range in the database in a fixed decimal format.'),
      'settings' => array(
        'precision' => 10,
        'scale' => 2,
        'decimal_separator' => '.',
      ),
      'instance_settings' => $instance_settings,
      'default_widget' => 'range',
      'default_formatter' => 'range_decimal',
      'property_type' => 'field_item_range',
      'property_callbacks' => array(
        'range_metadata_field_range_callback',
      ),
    ),
    'range_float' => array(
      'label' => t('Range: float'),
      'description' => t('This field stores a range in the database in a floating point format.'),
      'settings' => array(
        'decimal_separator' => '.',
      ),
      'instance_settings' => $instance_settings,
      'default_widget' => 'range',
      'default_formatter' => 'range_decimal',
      'property_type' => 'field_item_range',
      'property_callbacks' => array(
        'range_metadata_field_range_callback',
      ),
    ),
  );
}