function theme_file_widget

7.x theme_file_widget($variables)

Returns HTML for an individual file upload widget.


$variables: An associative array containing:

  • element: A render element representing the widget.

Related topics

2 string references to the theme hook from theme_file_widget()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

file_field_widget_process in drupal/modules/file/
An element #process callback for the file_generic field type.
file_theme in drupal/modules/file/file.module
Implements hook_theme().


drupal/modules/file/, line 806
Field module functionality for the File module.


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 ($element['fid']['#value'] != 0) {
    // Add the file size after the file name.
    $element['filename']['#markup'] .= ' <span class="file-size">(' . format_size($element['#file']->filesize) . ')</span> ';
  $output .= drupal_render_children($element);
  $output .= '</div>';

  return $output;