You are here

function cck_time_field_settings_form in CCK Time 7

Implements hook_field_settings_form().

File

./cck_time.module, line 31
Creates a time widget for CCK text fields

Code

function cck_time_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];
  $form = array();
  $form['format'] = array(
    '#type' => 'select',
    '#title' => t('Time format'),
    '#default_value' => $settings['format'],
    '#options' => array(
      24 => '24-hour (23:59)',
      12 => '12-hour (12:59AM)',
    ),
    '#description' => t('Record times in 24-hour format or in 12-hour format (with AM/PM).'),
    '#element_validate' => array(
      'cck_time_settings_format_validate',
    ),
  );
  $form['increment'] = array(
    '#type' => 'select',
    '#title' => t('Minute increment'),
    '#default_value' => $settings['increment'],
    '#options' => array(
      1 => 1,
      5 => 5,
      10 => 10,
      15 => 15,
      30 => 30,
    ),
    '#description' => t('Increment the minute values by this amount.'),
    '#element_validate' => array(
      'cck_time_settings_increment_validate',
    ),
  );
  return $form;
}