function theme_file

7.x form.inc theme_file($variables)

Returns HTML for a file upload form element.

For assistance with handling the uploaded file correctly, see the API provided by file.inc.

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #name, #size, #description, #required, #attributes.

Related topics

4 theme calls to theme_file()
FileFieldDisplayTestCase::testNodeDisplay in drupal/modules/file/tests/file.test
Tests normal formatter display on node display.
file_managed_file_process in drupal/modules/file/file.module
Process function to expand the managed_file element type.
theme_file_formatter_table in drupal/modules/file/file.field.inc
Returns HTML for a file attachments table.
theme_file_link in drupal/modules/file/file.module
Returns HTML for a link to a file.

File

drupal/includes/form.inc, line 3956
Functions for form and batch generation and processing.

Code

function theme_file($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'file';
  element_set_attributes($element, array('id', 'name', 'size'));
  _form_set_class($element, array('form-file'));

  return '<input' . drupal_attributes($element['#attributes']) . ' />';
}