diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index c5951d096..700c551bc 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -226,7 +226,7 @@ class Assets extends PropertyObject */ public function addJs($asset) { - return $this->addType(Assets::JS_TYPE, Assets::JS_TYPE, $asset, $this->unifyLegacyArguments(func_get_args())); + return $this->addType(Assets::JS_TYPE, Assets::JS_TYPE, $asset, $this->unifyLegacyArguments(func_get_args()), Assets::JS_TYPE); } /** @@ -236,7 +236,7 @@ class Assets extends PropertyObject */ public function addInlineJs($asset) { - return $this->addType(Assets::JS_TYPE, Assets::INLINE_JS_TYPE, $asset, $this->unifyLegacyArguments(func_get_args())); + return $this->addType(Assets::JS_TYPE, Assets::INLINE_JS_TYPE, $asset, $this->unifyLegacyArguments(func_get_args()), Assets::JS_TYPE); } diff --git a/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php b/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php index 8968cb6ec..d5746d977 100644 --- a/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php +++ b/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php @@ -8,10 +8,12 @@ namespace Grav\Common\Assets\Traits; +use Grav\Common\Assets; + trait LegacyAssetsTrait { - protected function unifyLegacyArguments($args) + protected function unifyLegacyArguments($args, $type = Assets::CSS_TYPE) { $arguments = []; @@ -35,10 +37,18 @@ trait LegacyAssetsTrait if (isset($args[1])) { $arguments['pipeline'] = $args[1]; } break; case 2: - if (isset($args[2])) { $arguments['group'] = $args[2]; } + if ($type === Assets::CSS_TYPE) { + if (isset($args[2])) { $arguments['group'] = $args[2]; } + } else { + if (isset($args[2])) { $arguments['loading'] = $args[2]; } + } break; case 3: - if (isset($args[3])) { $arguments['loading'] = $args[3]; } + if ($type === Assets::CSS_TYPE) { + if (isset($args[3])) { $arguments['loading'] = $args[3]; } + } else { + if (isset($args[3])) { $arguments['group'] = $args[3]; } + } break; } }