diff --git a/htdocs/includes/common.inc b/htdocs/includes/common.inc index 474a779232bab03656024c53be64436f89f68bf4..054ba3d57027d300ddbcb0ed439425927830b243 100644 --- a/htdocs/includes/common.inc +++ b/htdocs/includes/common.inc @@ -4207,6 +4207,10 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS switch ($item['type']) { case 'setting': $js_element = $element; + + // Attach custom attributes to the element. + $js_element['#attributes'] = !empty($item['attributes']) ? $item['attributes'] : array(); + $js_element['#value_prefix'] = $embed_prefix; $js_element['#value'] = 'jQuery.extend(Drupal.settings, ' . drupal_json_encode(drupal_array_merge_deep_array($item['data'])) . ");"; $js_element['#value_suffix'] = $embed_suffix; @@ -4215,6 +4219,10 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS case 'inline': $js_element = $element; + + // Attach custom attributes to the element. + $js_element['#attributes'] = !empty($item['attributes']) ? $item['attributes'] : array(); + if ($item['defer']) { $js_element['#attributes']['defer'] = 'defer'; } @@ -4226,6 +4234,9 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS case 'file': $js_element = $element; + // Attach custom attributes to the element. + $js_element['#attributes'] = !empty($item['attributes']) ? $item['attributes'] : array(); + if (!$item['preprocess'] || !$preprocess_js) { if ($item['defer']) { $js_element['#attributes']['defer'] = 'defer'; @@ -4253,7 +4264,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS // Attach custom attributes to the element. $js_element['#attributes'] = !empty($item['attributes']) ? $item['attributes'] : array(); - + // Preprocessing for external JavaScript files is ignored. if ($item['defer']) { $js_element['#attributes']['defer'] = 'defer';