Same name in other branches
- 5.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::deferJs()
- 6.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::deferJs()
- 8.x-3.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::deferJs()
Apply defer JS changes.
Paramètres
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $response: The response event object.
Fichier
-
advagg_mod/
src/ EventSubscriber/ InitSubscriber.php, line 220
Classe
- InitSubscriber
- Perform initialization tasks for advagg_mod.
Namespace
Drupal\advagg_mod\EventSubscriberCode
public function deferJs(FilterResponseEvent $response) {
// Skip if not enabled.
if (!$this->config
->get('js_defer')) {
return;
}
$response = $response->getResponse();
// Only process Html Responses.
if (!$response instanceof HtmlResponse) {
return;
}
$content = $this->jsDeferer
->defer($response->getContent());
$response->setContent($content);
}