You are here

function _webform_edit_time in Webform 6.3

Same name and namespace in other branches
  1. 5.2 components/time.inc \_webform_edit_time()
  2. 5 components/time.inc \_webform_edit_time()
  3. 6.2 components/time.inc \_webform_edit_time()
  4. 7.4 components/time.inc \_webform_edit_time()
  5. 7.3 components/time.inc \_webform_edit_time()

Implements _webform_edit_component().

File

components/time.inc, line 52
Webform module time component.

Code

function _webform_edit_time($component) {
  $form = array();
  $form['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Default value'),
    '#default_value' => $component['value'],
    '#description' => t('The default value of the field.') . '<br />' . t('Accepts a time in any <a href="http://www.gnu.org/software/tar/manual/html_chapter/Date-input-formats.html">GNU Date Input Format</a>. Strings such as now, +2 hours, and 10:30pm are all valid.'),
    '#size' => 60,
    '#maxlength' => 127,
    '#weight' => 0,
  );
  $form['extra']['timezone'] = array(
    '#type' => 'radios',
    '#title' => t('Default value timezone'),
    '#default_value' => $component['extra']['timezone'],
    '#description' => t('If using relative dates for a default value (e.g. "now") base the current time on this timezone.'),
    '#options' => array(
      'user' => t('User timezone'),
      'site' => t('Website timezone'),
    ),
    '#weight' => 2,
    '#access' => variable_get('configurable_timezones', 1) && module_exists('date_timezone'),
  );
  $form['display']['hourformat'] = array(
    '#type' => 'radios',
    '#title' => t('Time format'),
    '#default_value' => $component['extra']['hourformat'],
    '#options' => array(
      '12-hour' => t('12-hour (am/pm)'),
      '24-hour' => t('24-hour'),
    ),
    '#weight' => 2,
    '#parents' => array(
      'extra',
      'hourformat',
    ),
  );
  $form['display']['minuteincrements'] = array(
    '#type' => 'select',
    '#title' => t('Minute increments'),
    '#default_value' => $component['extra']['minuteincrements'],
    '#options' => array(
      1 => t('1 minute'),
      5 => t('5 minute'),
      10 => t('10 minute'),
      15 => t('15 minute'),
      30 => t('30 minute'),
    ),
    '#weight' => 3,
    '#parents' => array(
      'extra',
      'minuteincrements',
    ),
  );
  return $form;
}