From 623c2307256c68093407ffcff9cc37e544ca9a14 Mon Sep 17 00:00:00 2001 From: Roman Zimmermann Date: Mon, 11 Dec 2023 13:55:03 +0100 Subject: [PATCH] fix: No custom attributes for script without src attribute --- theming.module | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/theming.module b/theming.module index 0ff2800..64ec2d3 100644 --- a/theming.module +++ b/theming.module @@ -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; }