You are here

function date_field_info in Date 7.3

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

Implements hook_field_info().

3 calls to date_field_info()
date_tools_change_type_form in date_tools/date_tools.change_type.inc
Form constructor for the date type change form.
date_tools_change_type_form_submit in date_tools/date_tools.change_type.inc
Form submission handler for date_tools_change_type_form().
date_tools_wizard_field_types in date_tools/date_tools.wizard.inc
Implements hook_field_types().

File

./date.field.inc, line 251
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' => drupal_map_assoc($granularity),
      'tz_handling' => 'site',
      'timezone_db' => 'UTC',
    ),
    'instance_settings' => array(
      'default_value' => 'now',
      'default_value_code' => '',
      'default_value2' => 'same',
      'default_value_code2' => '',
    ),
    // Integrate with the Entity Metadata module.
    'property_type' => 'date',
    'property_callbacks' => array(
      'date_entity_metadata_property_info_alter',
    ),
  );
  return array(
    'datetime' => array(
      'label' => t('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' => t('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' => t('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,
  );
}