'; $element['upload_button']['#suffix'] = ''; $element['remove_button']['#prefix'] = ''; $element['remove_button']['#suffix'] = ''; $element['remove_button']['#attributes']['class'][] = 'btn-danger'; if (!empty($element['filename'])) { $element['filename']['#prefix'] = '
'; $element['filename']['#suffix'] = '
'; } // This wrapper is required to apply JS behaviors and CSS styling. $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 .= ''; return $output; }