You are here

function _webform_edit_countdown in Webform Countdown 7.2

Same name and namespace in other branches
  1. 7 webform_countdown.module \_webform_edit_countdown()

Implements _webform_edit_component().

File

./webform_countdown.module, line 77
Webform countdown code module.

Code

function _webform_edit_countdown($component) {
  $form = array();
  $form['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Default value'),
    '#default_value' => $component['value'],
    '#description' => t('The default value of the field.') . theme('webform_token_help'),
    '#cols' => 60,
    '#rows' => 5,
    '#weight' => 0,
  );
  $form['validation']['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#description' => t('Determines whether the counter counts chracters or words.'),
    '#default_value' => $component['extra']['type'],
    '#options' => array(
      'char' => t('Character'),
      'word' => t('Word'),
    ),
    '#multiple' => FALSE,
    '#weight' => 4,
    '#parents' => array(
      'extra',
      'type',
    ),
    '#weight' => 1,
  );
  $form['validation']['max'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum'),
    '#default_value' => $component['extra']['max'],
    '#description' => t('Maximum number of characters the field will accept.'),
    '#size' => 5,
    '#maxlength' => 10,
    '#parents' => array(
      'extra',
      'max',
    ),
    '#weight' => 2,
  );
  $form['validation']['message'] = array(
    '#type' => 'textfield',
    '#title' => t('Message'),
    '#default_value' => $component['extra']['message'],
    '#description' => t('Message that gets displayed alongside counter.'),
    '#parents' => array(
      'extra',
      'message',
    ),
    '#weight' => 3,
  );
  $form['display']['cols'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => $component['extra']['cols'],
    '#description' => t('Width of the textarea in columns. This property might not have a visual impact depending on the CSS of your site.') . ' ' . t('Leaving blank will use the default size.'),
    '#size' => 5,
    '#maxlength' => 10,
    '#parents' => array(
      'extra',
      'cols',
    ),
  );
  $form['display']['rows'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => $component['extra']['rows'],
    '#description' => t('Height of the textarea in rows.') . ' ' . t('Leaving blank will use the default size.'),
    '#size' => 5,
    '#maxlength' => 10,
    '#parents' => array(
      'extra',
      'rows',
    ),
  );
  $form['display']['resizable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Resizable'),
    '#description' => t('Make this field resizable by the user.'),
    '#weight' => 2,
    '#default_value' => $component['extra']['resizable'],
    '#parents' => array(
      'extra',
      'resizable',
    ),
  );
  $form['display']['placeholder'] = array(
    '#type' => 'textfield',
    '#title' => t('Placeholder'),
    '#default_value' => $component['extra']['placeholder'],
    '#description' => t('The placeholder will be shown in the field until the user starts entering a value.'),
    '#parents' => array(
      'extra',
      'placeholder',
    ),
  );
  $form['display']['disabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disabled'),
    '#return_value' => 1,
    '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
    '#weight' => 11,
    '#default_value' => $component['extra']['disabled'],
    '#parents' => array(
      'extra',
      'disabled',
    ),
  );
  return $form;
}