You are here

function date_field_widget_info in Date 7.2

Same name and namespace in other branches
  1. 7.3 date.field.inc \date_field_widget_info()
  2. 7 date.field.inc \date_field_widget_info()

Implements hook_field_widget_info().

1 call to date_field_widget_info()
date_tools_wizard_widget_types in date_tools/date_tools.wizard.inc
Implements hook_widget_types().

File

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

Code

function date_field_widget_info() {
  $settings = array(
    'settings' => array(
      'input_format' => date_default_format('date_select'),
      'input_format_custom' => '',
      'increment' => 15,
      'text_parts' => array(),
      'year_range' => '-3:+3',
      'label_position' => 'above',
    ),
    'behaviors' => array(
      'multiple values' => FIELD_BEHAVIOR_DEFAULT,
      'default value' => FIELD_BEHAVIOR_NONE,
    ),
  );
  $info = array(
    'date_select' => array(
      'label' => t('Select list'),
      'field types' => array(
        'date',
        'datestamp',
        'datetime',
      ),
    ) + $settings,
    'date_text' => array(
      'label' => t('Text field'),
      'field types' => array(
        'date',
        'datestamp',
        'datetime',
      ),
    ) + $settings,
  );
  if (module_exists('date_popup')) {
    $info['date_popup'] = array(
      'label' => t('Pop-up calendar'),
      'field types' => array(
        'date',
        'datestamp',
        'datetime',
      ),
    ) + $settings;
  }

  // The date text widget should use an increment of 1.
  $info['date_text']['settings']['increment'] = 1;
  return $info;
}