Complete documentation for the Date and Date API modules is available at !link.
', array('!link' => l('http://drupal.org/node/92460', 'http://drupal.org/node/92460'))); break; } } /** * Implementation of hook_field_info(). */ function date_field_info() { return array( 'date' => array('label' => 'Date'), 'datestamp' => array('label' => 'Datestamp'), ); } /** * Implementation of hook_field_settings(). */ function date_field_settings($op, $field) { include_once(drupal_get_path('module', 'date_api') .'/date.inc'); switch ($op) { case 'form': include_once(DATE_TIMEZONES); $form = array(); $tz_handling = $field['tz_handling'] ? $field['tz_handling'] : 'site'; $form['input'] = array( '#type' => 'fieldset', '#title' => t('Input options'), ); $options = array( 'Y' => t('Year'), 'M' => t('Month'), 'D' => t('Day'), 'H' => t('Hour'), 'N' => t('Minute'), 'S' => t('Second'), //'T' => t('Timezone'), ); $form['input']['granularity'] = array( '#type' => 'select', '#title' => t('Granularity'), '#default_value' => $field['granularity'] ? $field['granularity'] : array('Y', 'M', 'D'), '#options' => $options, '#multiple' => TRUE, '#size' => min(count($options), 6), '#description' => t('Set the date elements to be collected on input (at least a year is required).'), ); $form['input']['todate'] = array( '#type' => 'select', '#title' => t('To Date'), '#options' => array('' => t('Never'), 'optional' => t('Optional'), 'required' => t('Required')), '#description' => t('Display a matching second date field as a \'To date\'. If marked \'Optional\' field will be presented but not required. If marked \'Required\' the \'To date\' will be required if the \'From date\' is required or filled in.'), '#default_value' => $field['todate'] ? $field['todate'] : '', ); $form['input']['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced input options'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['input']['advanced']['input_format'] = array( '#type' => 'select', '#title' => t('Input format'), '#default_value' => $field['input_format'] ? $field['input_format'] : 'site_format', '#options' => date_input_options(), '#description' => t('The specified format will be adapted to the chosen granularity. The \'default\' value uses the \'short date format\' defined in !settings', array('!settings' => l("admin/settings", "admin/settings"))), ); $form['input']['advanced']['input_format_custom'] = array( '#type' => 'textfield', '#title' => t('Custom input format'), '#default_value' => $field['input_format_custom'] ? $field['input_format_custom'] : '', '#description' => t('The custom format, if provided, will override the input format selected above. See more about custom date formats below.'), ); $form['output'] = array( '#type' => 'fieldset', '#title' => t('Display Options'), '#description' => t('Choose the way the date should be displayed.'), ); $default_formatter = date_formatter_setup_form($field, 0); $form['output'][] = $default_formatter; $form['output']['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced display options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => t('Define alternate formatting for the date display. Options other than the default are made available to views and themes. Possible formats are default, long, medium, and short.'), ); for ($i = 1; $i <= 3; $i++) { $form['output']['advanced'][$i] = date_formatter_setup_form($field, $i); } $form['timezone'] = array( '#type' => 'fieldset', '#title' => t('Timezone options'), ); $form['timezone']['tz_handling'] = array( '#type' => 'select', '#title' => t('Time zone handling'), '#default_value' => $tz_handling, '#options' => date_timezone_handling_options(), '#description' => t('Select the timezone handling method to be used for this date field'), ); $form['timezone']['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced timezone options'), '#collapsible' => TRUE, '#collapsed' => (date_get_site_timezone() ? TRUE : FALSE), ); // need a way to identify the correct system timezone from an array of timezones with the same offset // save it as a system variable so it will default to the correct value after the first time it is set // aligns with system setting 'date_default_timezone' $form['timezone']['advanced']['field_timezone'] = array( '#type' => 'select', '#title' => t('Site timezone'), '#default_value' => date_get_site_timezone(), '#options' => drupal_map_assoc(date_timezone_options(variable_get('date_default_timezone', 'GMT'))), '#description' => t('Select the timezone to be used as the site\'s timezone for all date fields in every content type in which they appear. List includes GMT and all timezones with the same GMT offset as the site timezone setting.'), ); $form['#suffix'] = t('