You are here

function _webform_edit_time in Webform 7.4

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.3 components/time.inc \_webform_edit_time()
  4. 6.2 components/time.inc \_webform_edit_time()
  5. 7.3 components/time.inc \_webform_edit_time()

Implements _webform_edit_component().

File

components/time.inc, line 56
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['validation']['start_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Start time'),
    '#default_value' => $component['extra']['start_time'],
    '#description' => t('The earliest time that may be entered into the field.'),
    '#size' => 10,
    '#weight' => 3,
    '#parents' => array(
      'extra',
      'start_time',
    ),
  );
  $form['validation']['end_time'] = array(
    '#type' => 'textfield',
    '#title' => t('End time'),
    '#default_value' => $component['extra']['end_time'],
    '#description' => t('The latest time that may be entered into the field.'),
    '#size' => 10,
    '#weight' => 4,
    '#parents' => array(
      'extra',
      'end_time',
    ),
  );
  $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 (for example, "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),
  );
  $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',
    ),
  );
  $form['#validate'] = array(
    '_webform_edit_time_validate',
  );
  return $form;
}