_webform_edit_textfield
Drupal 7 _webform_edit_textfield($component)
Implements _webform_edit_component().
File
- sites/
all/ modules/ webform/ components/ textfield.inc, line 49 - Webform module textfield component.
Code
function _webform_edit_textfield($component) {
$form = array();
$form['value'] = array(
'#type' => 'textfield',
'#title' => t('Default value'),
'#default_value' => $component['value'],
'#description' => t('The default value of the field.') . theme('webform_token_help'),
'#size' => 60,
'#maxlength' => 1024,
'#weight' => 0,
);
$form['display']['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $component['extra']['width'],
'#description' => t('Width of the textfield.') . ' ' . t('Leaving blank will use the default size.'),
'#size' => 5,
'#maxlength' => 10,
'#weight' => 0,
'#parents' => array('extra', 'width'),
);
$form['display']['field_prefix'] = array(
'#type' => 'textfield',
'#title' => t('Prefix text placed to the left of the textfield'),
'#default_value' => $component['extra']['field_prefix'],
'#description' => t('Examples: $, #, -.'),
'#size' => 20,
'#maxlength' => 127,
'#weight' => 1.1,
'#parents' => array('extra', 'field_prefix'),
);
$form['display']['field_suffix'] = array(
'#type' => 'textfield',
'#title' => t('Postfix text placed to the right of the textfield'),
'#default_value' => $component['extra']['field_suffix'],
'#description' => t('Examples: lb, kg, %.'),
'#size' => 20,
'#maxlength' => 127,
'#weight' => 1.2,
'#parents' => array('extra', 'field_suffix'),
);
$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'),
);
$form['validation']['unique'] = array(
'#type' => 'checkbox',
'#title' => t('Unique'),
'#return_value' => 1,
'#description' => t('Check that all entered values for this field are unique. The same value is not allowed to be used twice.'),
'#weight' => 1,
'#default_value' => $component['extra']['unique'],
'#parents' => array('extra', 'unique'),
);
$form['validation']['maxlength'] = array(
'#type' => 'textfield',
'#title' => t('Maxlength'),
'#default_value' => $component['extra']['maxlength'],
'#description' => t('Maximum length of the textfield value.'),
'#size' => 5,
'#maxlength' => 10,
'#weight' => 2,
'#parents' => array('extra', 'maxlength'),
);
return $form;
}

