function theme_webform_managed_file in Webform 7.4
Returns HTML for a webform managed file element.
See #2495821 and #2497909. The core theme_file_managed_file creates a wrapper around the element with the element's id, thereby creating 2 elements with the same id.
Parameters
array $variables: An associative array containing:
- element: A render element representing the file.
Return value
string The HTML.
1 theme call to theme_webform_managed_file()
- _webform_render_file in components/
file.inc - Implements _webform_render_component().
File
- components/
file.inc, line 387 - Webform module file component.
Code
function theme_webform_managed_file($variables) {
$element = $variables['element'];
$attributes = array();
// For webform use, do not add the id to the wrapper.
// @code
// if (isset($element['#id'])) {
// $attributes['id'] = $element['#id'];
// }
// @endcode
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' . drupal_attributes($attributes) . '>';
$output .= drupal_render_children($element);
$output .= '</div>';
return $output;
}