Merge pull request #1172 from mhancoc7/patch-2

Allow passing in attributes for Theme js files
This commit is contained in:
Diego Najar 2020-04-10 13:06:30 +02:00 committed by GitHub
commit f1d970bb3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -206,7 +206,7 @@ class Theme {
return $links;
}
public static function javascript($files, $base=DOMAIN_THEME)
public static function javascript($files, $base=DOMAIN_THEME, $attributes="async")
{
if( !is_array($files) ) {
$files = array($files);
@ -214,15 +214,15 @@ class Theme {
$scripts = '';
foreach($files as $file) {
$scripts .= '<script async src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
$scripts .= '<script '.$attributes.' src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
return $scripts;
}
public static function js($files, $base=DOMAIN_THEME)
public static function js($files, $base=DOMAIN_THEME, $attributes="async")
{
return self::javascript($files, $base);
return self::javascript($files, $base, $attributes);
}
public static function plugins($type)