1 date.field.inc date_field_info()

Implements hook_field_info().

File

core/modules/date/date.field.inc, line 224
Field hooks to implement a date field.

Code

function date_field_info() {
  $granularity = array('year', 'month', 'day', 'hour', 'minute');
  $settings = array(
    'settings' => array(
      'todate' => '',
      'granularity' => backdrop_map_assoc($granularity),
      'tz_handling' => 'site',
      'timezone_db' => 'UTC',
    ),
    'instance_settings' => array(
      'default_value' => 'blank',
      'default_value_code' => '',
      'default_value2' => 'same',
      'default_value_code2' => '',
    ),
  );
  return array(
    'datetime' => array(
      'label' => 'Date',
      'description' => t('Store a date in the database as a datetime field, recommended for complete dates and times that may need timezone conversion.'),
      'default_widget' => 'date_select',
      'default_formatter' => 'date_default',
      'default_token_formatter' => 'date_plain',
    ) + $settings,
    'date' => array(
      'label' => 'Date (ISO format)',
      'description' => t('Store a date in the database as an ISO date, recommended for historical or partial dates.'),
      'default_widget' => 'date_select',
      'default_formatter' => 'date_default',
      'default_token_formatter' => 'date_plain',
    ) + $settings,
    'datestamp' => array(
      'label' => 'Date (Unix timestamp)',
      'description' => t('Store a date in the database as a timestamp, deprecated format to support legacy data.'),
      'default_widget' => 'date_select',
      'default_formatter' => 'date_default',
      'default_token_formatter' => 'date_plain',
    ) + $settings,
  );
}