You are here

function date_field_formatter_info in Date 7

Same name and namespace in other branches
  1. 5.2 date/date.module \date_field_formatter_info()
  2. 5 date.module \date_field_formatter_info()
  3. 6.2 date/date.module \date_field_formatter_info()
  4. 6 date/date.module \date_field_formatter_info()
  5. 7.3 date.field.inc \date_field_formatter_info()
  6. 7.2 date.field.inc \date_field_formatter_info()

Implements hook_field_formatter_info().

File

./date.field.inc, line 10
Field hooks to implement a date field.

Code

function date_field_formatter_info() {
  $formatters = array(
    'date_default' => array(
      'label' => t('Default'),
      'field types' => array(
        'date',
        'datestamp',
        'datetime',
      ),
      'settings' => array(
        'format_type' => 'long',
        'show_repeat_rule' => 'show',
        'multiple_number' => '',
        'multiple_from' => '',
        'multiple_to' => '',
        'fromto' => 'both',
      ),
    ),
    'format_interval' => array(
      'label' => t('As Time Ago'),
      'field types' => array(
        'date',
        'datestamp',
        'datetime',
      ),
      'settings' => array(
        'interval' => 2,
      ),
    ),
  );
  $formats = _system_date_format_types_build();
  foreach ($formats as $format => $value) {
    $formatters['date_' . $format] = $formatters['date_default'];
    $formatters['date_' . $format]['format_type'] = $format;
    $formatters['date_' . $format]['label'] = $value['title'];
  }
  return $formatters;
}