Skip to content

Commit

Permalink
Merge pull request #5 from moreonion/fix-scripts-without-src
Browse files Browse the repository at this point in the history
fix: No custom attributes for script without src attribute
  • Loading branch information
torotil authored Dec 18, 2023
2 parents c470339 + 623c230 commit a5ed3b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions theming.module
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function theming_pre_render_scripts(array $elements) {
continue;
}
$attributes = &$processed_elements['scripts'][$index]['#attributes'];
$custom_attributes = $elements['#items'][$attributes['src']]['attributes'] ?? [];
$attributes = $custom_attributes + $attributes;
if ($src = $attributes['src'] ?? NULL) {
$custom_attributes = $elements['#items'][$src]['attributes'] ?? [];
$attributes = $custom_attributes + $attributes;
}
}
return $processed_elements;
}

0 comments on commit a5ed3b8

Please sign in to comment.