You are here

function date_tools_wizard_form in Date 7.3

Same name and namespace in other branches
  1. 8 date_tools/date_tools.wizard.inc \date_tools_wizard_form()
  2. 6.2 date_tools/date_tools.wizard.inc \date_tools_wizard_form()
  3. 7 date_tools/date_tools.wizard.inc \date_tools_wizard_form()
  4. 7.2 date_tools/date_tools.wizard.inc \date_tools_wizard_form()

Implements hook_form().

1 string reference to 'date_tools_wizard_form'
date_tools_menu in date_tools/date_tools.module
Implements hook_menu().

File

date_tools/date_tools.wizard.inc, line 11
The Date Wizard code.

Code

function date_tools_wizard_form() {
  $form = array();
  $form['type'] = array(
    '#type' => 'fieldset',
    '#title' => t('Content type'),
  );
  $form['type']['bundle'] = array(
    '#type' => 'textfield',
    '#default_value' => 'date',
    '#title' => t('Content type name'),
    '#description' => t('Machine-readable name. Allowed values: (a-z, 0-9, _). If this is not an existing content type, the content type will be created.'),
  );
  $form['type']['name'] = array(
    '#type' => 'textfield',
    '#default_value' => t('Date'),
    '#title' => t('Content type label'),
    '#description' => t('The human-readable name for this content type. Only needed when creating a new content type.'),
  );
  $form['type']['type_description'] = array(
    '#type' => 'textarea',
    '#default_value' => t('A date content type that is linked to a Views calendar.'),
    '#title' => t('Content type description'),
    '#description' => t('A description for the content type. Only needed when creating a new content type.'),
  );
  $form['field'] = array(
    '#type' => 'fieldset',
    '#title' => t('Date field'),
  );
  $form['field']['field_name'] = array(
    '#type' => 'textfield',
    '#default_value' => 'date',
    '#field_prefix' => 'field_',
    '#title' => t('Date field name'),
    '#description' => t('Machine-readable name. Allowed values: (a-z, 0-9, _) Must not be an existing field name.'),
  );
  $form['field']['label'] = array(
    '#tree' => TRUE,
    '#type' => 'textfield',
    '#default_value' => t('Date'),
    '#title' => t('Date field label'),
    '#description' => t('The human-readable label for this field.'),
  );
  $form['field']['widget_type'] = array(
    '#type' => 'select',
    '#options' => date_tools_wizard_widget_types(),
    '#default_value' => 'date_select',
    '#title' => t('Date widget type'),
  );
  $form['field']['repeat'] = array(
    '#type' => 'select',
    '#default_value' => 0,
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#title' => t('Show repeating date options'),
    '#access' => module_exists('date_repeat_field'),
  );
  $form['field']['advanced'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Advanced options'),
  );
  $form['field']['advanced']['todate'] = array(
    '#type' => 'select',
    '#default_value' => 'optional',
    '#options' => array(
      '' => t('Never'),
      'optional' => t('Optional'),
      'required' => t('Required'),
    ),
    '#title' => t('End Date'),
    '#description' => t("Display a matching second date field as a 'End date'."),
  );
  $form['field']['advanced']['field_type'] = array(
    '#type' => 'select',
    '#options' => date_tools_wizard_field_types(),
    '#default_value' => 'datetime',
    '#title' => t('Date field type'),
    '#description' => t("The recommend type is Datetime, except for historical dates or dates with only year or month granularity. Older or incomplete dates should use the Date type (an ISO date)."),
  );
  $form['field']['advanced']['granularity'] = array(
    '#type' => 'select',
    '#options' => date_granularity_names(),
    '#default_value' => array(
      'month',
      'day',
      'year',
      'hour',
      'minute',
    ),
    '#title' => t('Granularity'),
    '#multiple' => TRUE,
  );
  $form['field']['advanced']['year_range'] = array(
    '#type' => 'textfield',
    '#default_value' => '-1:+1',
    '#title' => t('Year range'),
    '#description' => t("Range of allowed years, oldest to newest. '-1:+1 means oldest date is one year back, newest is one year forward from current year."),
  );
  $form['field']['advanced']['tz_handling'] = array(
    '#type' => 'select',
    '#options' => date_tools_wizard_tz_handling(),
    '#default_value' => 'site',
    '#title' => t('Date timezone handling'),
    '#description' => t("Timezone handling should be set to 'none' for granularity without time elements."),
  );
  $form['field']['advanced']['weight'] = array(
    '#type' => 'textfield',
    '#default_value' => '-4',
    '#title' => t('Weight'),
    '#description' => t("Set the field weight."),
  );
  $form['calendar'] = array(
    '#type' => 'select',
    '#default_value' => module_exists('calendar'),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#title' => t('Create a calendar for this date field'),
    '#access' => module_exists('calendar'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}