function _webform_edit_grid in Webform 5
Same name and namespace in other branches
- 5.2 components/grid.inc \_webform_edit_grid()
- 6.3 components/grid.inc \_webform_edit_grid()
- 6.2 components/grid.inc \_webform_edit_grid()
- 7.4 components/grid.inc \_webform_edit_grid()
- 7.3 components/grid.inc \_webform_edit_grid()
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/
grid.inc, line 10
Code
function _webform_edit_grid($currfield) {
$edit_fields = array();
$edit_fields['extra']['options'] = array(
'#type' => 'textarea',
'#title' => t("Options"),
'#default_value' => $currfield['extra']['options'],
'#description' => t('Options to select across the top. 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' => -3,
'#required' => TRUE,
);
$edit_fields['extra']['questions'] = array(
'#type' => 'textarea',
'#title' => t("Questions"),
'#default_value' => $currfield['extra']['questions'],
'#description' => t('Questions list down the left side. One question per line.') . '<br />' . webform_help('webform/helptext#variables'),
'#cols' => 60,
'#rows' => 5,
'#weight' => -2,
'#required' => TRUE,
);
$edit_fields['extra']['optrand'] = array(
'#type' => 'checkbox',
'#title' => t('Randomize Options'),
'#default_value' => $currfield['extra']['optrand'],
'#description' => t('Randomizes the order of options on the top when they are displayed in the form.'),
);
$edit_fields['extra']['qrand'] = array(
'#type' => 'checkbox',
'#title' => t('Randomize Questions'),
'#default_value' => $currfield['extra']['qrand'],
'#description' => t('Randomize the order of the questions on the side when they are displayed in the form.'),
);
return $edit_fields;
}