| 1 file.theme.inc | theme_file_widget($variables) |
Returns HTML for an individual file upload widget.
Parameters
$variables: An associative array containing:
- element: A render element representing the widget.
Related topics
File
- core/
modules/ file/ file.theme.inc, line 138 - Theme functions for the File module.
Code
function theme_file_widget($variables) {
$element = $variables['element'];
$output = '';
// The "form-managed-file" class is required for proper Ajax functionality.
$output .= '<div class="file-widget form-managed-file clearfix">';
if (!empty($element['fid']['#value'])) {
// Add the file size after the file name.
$file = reset($element['#files']);
$element['file_' . $file->fid]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->filesize) . ')</span> ';
}
$output .= backdrop_render_children($element);
$output .= '</div>';
return $output;
}