diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index cf4a9cec9..a03f44760 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -470,7 +470,7 @@ class Assets * * @return $this */ - public function addInlineJs($asset, $priority = null, $group = null) + public function addInlineJs($asset, $priority = null, $group = null, $attributes = null) { $asset = trim($asset); @@ -485,7 +485,8 @@ class Assets 'asset' => $asset, 'priority' => intval($priority ?: 10), 'order' => count($this->js), - 'group' => $group ?: 'head' + 'group' => $group ?: 'head', + 'type' => $attributes ?: '', ]; // check for dynamic array and merge with defaults @@ -667,7 +668,10 @@ class Assets } if ($inline_js) { - $output .= "\n\n"; + if ($inline['type']){ + $attributeString = " type=\"" . $inline['type'] . "\""; + } + $output .= "\n" . $inline_js . "\n\n"; } return $output;