This repository was archived by the owner on Nov 3, 2023. It is now read-only.
File tree 1 file changed +15
-2
lines changed
system/modules/core/library/Contao
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1948,18 +1948,26 @@ public static function replaceDynamicScriptTags($strBuffer)
1948
1948
if (!empty ($ GLOBALS ['TL_JAVASCRIPT ' ]) && is_array ($ GLOBALS ['TL_JAVASCRIPT ' ]))
1949
1949
{
1950
1950
$ objCombiner = new \Combiner ();
1951
+ $ objCombinerAsync = new \Combiner ();
1951
1952
1952
1953
foreach (array_unique ($ GLOBALS ['TL_JAVASCRIPT ' ]) as $ javascript )
1953
1954
{
1954
1955
$ options = \String::resolveFlaggedUrl ($ javascript );
1955
1956
1956
1957
if ($ options ->static )
1957
1958
{
1958
- $ objCombiner ->add ($ javascript , filemtime (TL_ROOT . '/ ' . $ javascript ));
1959
+ if ($ options ->async )
1960
+ {
1961
+ $ objCombinerAsync ->add ($ javascript , filemtime (TL_ROOT . '/ ' . $ javascript ));
1962
+ }
1963
+ else
1964
+ {
1965
+ $ objCombiner ->add ($ javascript , filemtime (TL_ROOT . '/ ' . $ javascript ));
1966
+ }
1959
1967
}
1960
1968
else
1961
1969
{
1962
- $ strScripts .= \Template::generateScriptTag (static ::addStaticUrlTo ($ javascript ), $ blnXhtml ) . "\n" ;
1970
+ $ strScripts .= \Template::generateScriptTag (static ::addStaticUrlTo ($ javascript ), $ blnXhtml, $ options -> async ) . "\n" ;
1963
1971
}
1964
1972
}
1965
1973
@@ -1968,6 +1976,11 @@ public static function replaceDynamicScriptTags($strBuffer)
1968
1976
{
1969
1977
$ strScripts = \Template::generateScriptTag ($ objCombiner ->getCombinedFile (), $ blnXhtml ) . "\n" . $ strScripts ;
1970
1978
}
1979
+
1980
+ if ($ objCombinerAsync ->hasEntries ())
1981
+ {
1982
+ $ strScripts = \Template::generateScriptTag ($ objCombinerAsync ->getCombinedFile (), $ blnXhtml , true ) . "\n" . $ strScripts ;
1983
+ }
1971
1984
}
1972
1985
1973
1986
// Add the internal <head> tags
You can’t perform that action at this time.
0 commit comments