1.20.x file.theme.inc theme_file_managed_file($variables)

Returns HTML for a managed file element.

Parameters

$variables: An associative array containing:

  • element: A render element representing the file.

Related topics

File

modules/file/file.theme.inc, line 16
Theme functions for the File module.

Code

function theme_file_managed_file($variables) {
  $element = $variables['element'];

  $attributes = array();
  if (isset($element['#id'])) {
    $attributes['id'] = $element['#id'];
  }
  if (!empty($element['#attributes']['class'])) {
    $attributes['class'] = (array) $element['#attributes']['class'];
  }
  $attributes['class'][] = 'form-managed-file';

  // This wrapper is required to apply JS behaviors and CSS styling.
  $output = '';
  $output .= '<div' . backdrop_attributes($attributes) . '>';
  $output .= backdrop_render_children($element);
  $output .= '</div>';
  return $output;
}