mirror of
https://github.com/getgrav/grav.git
synced 2026-07-20 23:21:14 +02:00
legacy fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user