function _webform_edit_textfield in Webform 5.2
Same name and namespace in other branches
- 5 components/textfield.inc \_webform_edit_textfield()
- 6.3 components/textfield.inc \_webform_edit_textfield()
- 6.2 components/textfield.inc \_webform_edit_textfield()
- 7.4 components/textfield.inc \_webform_edit_textfield()
- 7.3 components/textfield.inc \_webform_edit_textfield()
Create a set of form items to be displayed on the form for editing this component. Use care naming the form items, as this correlates directly to the database schema. The component "Name" and "Description" fields are added to every component type and are not necessary to specify here (although they may be overridden if desired).
Return value
An array of form items to be displayed on the edit component page.
File
- components/
textfield.inc, line 41 - Webform module textfield component.
Code
function _webform_edit_textfield($currfield) {
$edit_fields = array();
$edit_fields['value'] = array(
'#type' => 'textfield',
'#title' => t('Default value'),
'#default_value' => $currfield['value'],
'#description' => t('The default value of the field.') . theme('webform_token_help'),
'#size' => 60,
'#maxlength' => 127,
'#weight' => 0,
);
$edit_fields['extra']['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $currfield['extra']['width'],
'#description' => t('Width of the textfield.') . ' ' . t('Leaving blank will use the default size.'),
'#size' => 5,
'#maxlength' => 10,
'#weight' => 0,
);
$edit_fields['extra']['maxlength'] = array(
'#type' => 'textfield',
'#title' => t('Maxlength'),
'#default_value' => $currfield['extra']['maxlength'],
'#description' => t('Maxlength of the textfield.'),
'#size' => 5,
'#maxlength' => 10,
'#weight' => 0,
);
$edit_fields['extra']['field_prefix'] = array(
'#type' => 'textfield',
'#title' => t('Label placed to the left of the textfield'),
'#default_value' => $currfield['extra']['field_prefix'],
'#description' => t('Examples: $, #, -.'),
'#size' => 20,
'#maxlength' => 127,
'#weight' => 1.1,
);
$edit_fields['extra']['field_suffix'] = array(
'#type' => 'textfield',
'#title' => t('Label placed to the right of the textfield'),
'#default_value' => $currfield['extra']['field_suffix'],
'#description' => t('Examples: lb, kg, %.'),
'#size' => 20,
'#maxlength' => 127,
'#weight' => 1.2,
);
$edit_fields['extra']['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' => 3,
'#default_value' => $currfield['extra']['disabled'],
);
return $edit_fields;
}