Commit b3c88f97 authored by geoffreyr's avatar geoffreyr Committed by olstjos

Issue #2511142 by geoffreyr: theme_media_widget ignores attributes set by other contrib modules

parent 3614a88f
......@@ -433,8 +433,20 @@ function theme_media_widget($variables) {
$element = $variables['element'];
$output = '';
// Merge provided attributes with existing ones.
// The "form-media" class is required for proper Ajax functionality.
$output .= '<div class="media-widget form-media clearfix">';
$attributes = array(
'class' => array("media-widget", "form-media", "clearfix"),
);
if (!empty($element['#attributes'])) {
$attributes = array_merge_recursive($attributes, $element['#attributes']);
}
if (!empty($element['#id'])) {
$attributes = array_merge_recursive($attributes, array('id' => $element['#id'] . '--widget'));
}
// Render attributes into div in one go.
$output .= '<div ' . drupal_attributes($attributes) . '>';
$output .= drupal_render_children($element);
$output .= '</div>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment