function _webform_edit_select in Webform 5
Same name and namespace in other branches
- 5.2 components/select.inc \_webform_edit_select()
- 6.3 components/select.inc \_webform_edit_select()
- 6.2 components/select.inc \_webform_edit_select()
- 7.4 components/select.inc \_webform_edit_select()
- 7.3 components/select.inc \_webform_edit_select()
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/
select.inc, line 11
Code
function _webform_edit_select($currfield) {
$edit_fields = array();
$edit_fields['extra']['items'] = array(
'#type' => 'textarea',
'#title' => t("Options"),
'#default_value' => $currfield['extra']['items'],
'#description' => t('A list of selectable options. One option per line. Key-value pairs may be entered seperated by pipes. i.e. safe_key|Some readable option') . '<br />' . webform_help('webform/helptext#variables'),
'#cols' => 60,
'#rows' => 5,
'#weight' => -2,
'#required' => TRUE,
);
$edit_fields['value'] = array(
'#type' => 'textfield',
'#title' => t("Default value"),
'#default_value' => $currfield['default'],
'#description' => t('The default value of the field. For multiple selects use commas to separate multiple defaults.') . '<br />' . webform_help('webform/helptext#variables'),
'#size' => 60,
'#maxlength' => 256,
'#weight' => 0,
);
$edit_fields['extra']['multiple'] = array(
'#type' => 'checkbox',
'#title' => t("Multiple"),
'#return_value' => 'Y',
'#default_value' => $currfield['extra']['multiple'] == 'Y' ? TRUE : FALSE,
'#description' => t('Check this option if the user should be allowed to choose multiple values.'),
);
$edit_fields['extra']['aslist'] = array(
'#type' => 'checkbox',
'#title' => t("Listbox"),
'#return_value' => 'Y',
'#default_value' => $currfield['extra']['aslist'] == 'Y' ? TRUE : FALSE,
'#description' => t('Check this option if you want the select component to be of listbox type instead of radiobuttons or checkboxes.'),
);
return $edit_fields;
}