1 date.field.inc date_field_widget_info()

Implements hook_field_widget_info().

File

core/modules/date/date.field.inc, line 268
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' => 1,
      'text_parts' => array(),
      'year_range' => '-3:+3',
      'label_position' => 'none',
      'no_fieldset' => TRUE,
    ),
    'behaviors' => array(
      'multiple values' => FIELD_BEHAVIOR_DEFAULT,
      'default value' => FIELD_BEHAVIOR_NONE,
    ),
  );

  $info = array(
    'date_popup' => array(
      'label' => t('Pop-up calendar'),
      'field types' => array('date', 'datestamp', 'datetime'),
    ) + $settings,
    '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,
  );

  // Add the fieldset option for select fields only.
  $info['date_select']['settings']['no_fieldset'] = FALSE;

  // HTML5 widget with slightly different settings.
  $info['date_html5'] = array(
    'label' => t('HTML5 widget'),
    'field types' => array('date', 'datetime', 'datestamp'),
    'settings' => array(
      'limits' => array(
        'mode' => 'none',
        'years_back' => -3,
        'years_forward' => 3,
      ),
      'no_fieldset' => TRUE,
    ),
  );

  return $info;
}