';
$element['upload_button']['#suffix'] = '';
// The "form-managed-file" class is required for proper Ajax functionality.
if (!empty($element['filename'])) {
$output .= '
';
// Add the file size after the file name.
$element['filename']['#markup'] .= ' ' . format_size($element['#file']->filesize) . '';
}
else {
$output .= '
';
}
// Immediately render hidden elements before the rest of the output.
// The uploadprogress extension requires that the hidden identifier input
// element appears before the file input element. They must also be siblings
// inside the same parent element.
// @see https://www.drupal.org/node/2155419
foreach (element_children($element) as $child) {
if (isset($element[$child]['#type']) && $element[$child]['#type'] === 'hidden') {
$output .= drupal_render($element[$child]);
}
}
// Render the rest of the element.
$output .= drupal_render_children($element);
$output .= '