function theme_file
7.x form.inc | theme_file( |
6.x form.inc | theme_file($element) |
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
5 theme calls to theme_file()
- FileFieldDisplayTestCase::testNodeDisplay in drupal-7.x/
modules/ file/ tests/ file.test - Tests normal formatter display on node display.
- file_managed_file_process in drupal-7.x/
modules/ file/ file.module - Process function to expand the managed_file element type.
- system_element_info in drupal-7.x/
modules/ system/ system.module - Implements hook_element_info().
- theme_file_formatter_table in drupal-7.x/
modules/ file/ file.field.inc - Returns HTML for a file attachments table.
- theme_file_link in drupal-7.x/
modules/ file/ file.module - Returns HTML for a link to a file.
File
- drupal-7.x/
includes/ form.inc, line 3967 - 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']) . ' />';
}