Same name in other branches
- 5.0.x advagg_mod/src/Asset/AsyncJs.php \Drupal\advagg_mod\Asset\AsyncJs::async()
- 6.0.x advagg_mod/src/Asset/AsyncJs.php \Drupal\advagg_mod\Asset\AsyncJs::async()
- 8.x-4.x advagg_mod/src/Asset/AsyncJs.php \Drupal\advagg_mod\Asset\AsyncJs::async()
Add Async attribute to all external script tags.
Paramètres
string $content: The response content.
Return value
string Updated content.
Fichier
-
advagg_mod/
src/ Asset/ AsyncJs.php, line 19
Classe
- AsyncJs
- Add async tag to scripts.
Namespace
Drupal\advagg_mod\AssetCode
public function async($content) {
$pattern = '/<script src=".*"/';
return preg_replace_callback($pattern, [
$this,
'callback',
], $content);
}