function _webform_render_file in Webform 6.2
Same name and namespace in other branches
- 5.2 components/file.inc \_webform_render_file()
- 5 components/file.inc \_webform_render_file()
- 6.3 components/file.inc \_webform_render_file()
- 7.4 components/file.inc \_webform_render_file()
- 7.3 components/file.inc \_webform_render_file()
Build a form item array containing all the properties of this component.
Parameters
$component: An array of information describing the component, directly correlating to the webform_component database schema.
Return value
An array of a form item to be displayed on the client-side webform.
1 call to _webform_render_file()
- _webform_submission_display_file in components/
file.inc - Display the result of a file submission. The output of this function will be displayed under the "results" tab then "submissions".
File
- components/
file.inc, line 270 - Webform module file component.
Code
function _webform_render_file($component) {
$form_item[$component['form_key']] = array(
'#type' => $component['type'],
'#title' => $component['name'],
//'#required' => $component['mandatory'], // Drupal core bug with required file uploads.
'#weight' => $component['weight'],
'#description' => _webform_filter_descriptions($component['extra']['description']),
'#attributes' => $component['extra']['attributes'],
'#tree' => FALSE,
// file_check_upload assumes a flat $_FILES structure.
'#prefix' => '<div class="webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
'#suffix' => '</div>',
'#element_validate' => array(
'_webform_validate_file',
'_webform_required_file',
),
'#webform_component' => $component,
);
$form_item['#weight'] = $component['weight'];
$form_item['new'] = array(
'#type' => 'hidden',
'#weight' => $component['weight'],
'#value' => $component['form_key'],
'#tree' => TRUE,
);
// Change the 'width' option to the correct 'size' option.
if ($component['extra']['width'] > 0) {
$form_item[$component['form_key']]['#size'] = $component['extra']['width'];
}
return $form_item;
}