function _webform_render_file in Webform 5
Same name and namespace in other branches
- 5.2 components/file.inc \_webform_render_file()
- 6.3 components/file.inc \_webform_render_file()
- 6.2 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 180
Code
function _webform_render_file($component) {
$form_item = array(
'#type' => $component['type'],
'#title' => $component['name'],
//'#required' => $component['mandatory'], // Drupal core bug with required file uploads
'#weight' => $component['weight'],
'#description' => _webform_filtervalues($component['extra']['description']),
'#attributes' => $component['extra']['attributes'],
'#tree' => false,
// file_check_upload assumes a flat $_FILES structure.
'#validate' => array(
'_webform_validate_file' => array(
$component['form_key'],
$component['name'],
$component['extra']['filtering'],
),
'_webform_required_file' => array(
$component['form_key'],
$component['name'],
$component['mandatory'],
),
),
'#prefix' => '<div class="webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
'#suffix' => '</div>',
);
return $form_item;
}