You are here

function date_form_date_api_date_formats_form_alter in Date 6.2

Implementation of hook_form_alter().

Adding ability to configure new date format types.

File

date/date.module, line 737
Defines date/time field types for the Content Construction Kit (CCK).

Code

function date_form_date_api_date_formats_form_alter(&$form, $form_state, $form_id = 'date_api_date_formats_form') {

  // Add form entry field for adding new format type.
  $form['add_format_type'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add format type'),
    '#weight' => 1,
  );
  $form['add_format_type']['add_date_format_title'] = array(
    '#title' => t('Name'),
    '#description' => t('The human-readable name for this format type.'),
    '#type' => 'textfield',
    '#size' => 20,
    '#prefix' => '<div class="date-container"><div class="date-format-name">',
    '#suffix' => '</div>',
  );
  $form['add_format_type']['add_date_format_type'] = array(
    '#title' => t('Type'),
    '#description' => t('The machine-readable name of this format type. <br>This name must contain only lowercase letters, numbers, and underscores and must be unique.'),
    '#type' => 'textfield',
    '#size' => 20,
    '#prefix' => '<div class="date-format-type">',
    '#suffix' => '</div></div>',
  );
  $form['#submit'][] = 'date_date_time_settings_submit';
  $form['#validate'][] = 'date_date_time_settings_validate';
  $form['buttons']['#weight'] = 5;
}