function _webform_submission_display_hidden in Webform 6.2
Same name and namespace in other branches
- 5.2 components/hidden.inc \_webform_submission_display_hidden()
- 5 components/hidden.inc \_webform_submission_display_hidden()
Display the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions".
Parameters
$data: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema.
$component: An array of information describing the component, directly correlating to the webform_component database schema.
$enabled: If enabled, the value may be changed. Otherwise it will set to readonly.
Return value
Textual output formatted for human reading.
File
- components/
hidden.inc, line 91 - Webform module hidden component.
Code
function _webform_submission_display_hidden($data, $component, $enabled = FALSE) {
$form_item = _webform_render_hidden($component);
// Only allow administrators that can view or edit all submissions to view or edit hidden fields.
if (user_access('edit webform submissions') || user_access('access webform results')) {
unset($form_item['#value']);
$form_item['#default_value'] = $data['value']['0'];
$form_item['#type'] = 'textfield';
$form_item['#title'] = t('@name (hidden)', array(
'@name' => $component['name'],
));
if (!$enabled) {
$form_item['#attributes']['readonly'] = 'readonly';
}
}
return $form_item;
}