function _webform_edit_textfield in Webform 5
Same name and namespace in other branches
- 5.2 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 11
Code
function _webform_edit_textfield($currfield) {
$edit_fields = array();
$edit_fields['value'] = array(
'#type' => 'textfield',
'#title' => t("Default value"),
'#default_value' => $currfield['default'],
'#description' => t('The default value of the field.') . '<br />' . webform_help('webform/helptext#variables'),
'#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.'),
'#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']['attributes']['disabled'] = array(
'#type' => 'checkbox',
'#title' => t("Disabled"),
'#return_value' => 'disabled',
'#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
'#weight' => 3,
'#default_value' => $currfield['extra']['attributes']['disabled'],
);
return $edit_fields;
}