Same name in other branches
  1. 5.0.x advagg_mod/src/Asset/DeferJs.php \Drupal\advagg_mod\Asset\DeferJs::__construct()
  2. 8.x-3.x advagg_mod/src/Asset/DeferJs.php \Drupal\advagg_mod\Asset\DeferJs::__construct()
  3. 8.x-4.x advagg_mod/src/Asset/DeferJs.php \Drupal\advagg_mod\Asset\DeferJs::__construct()

DeferCss constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The Drupal module handler.

ExtensionList $module_extension_list: The module extension list service.

File

advagg_mod/src/Asset/DeferJs.php, line 60

Class

DeferJs
Add defer tag to scripts.

Namespace

Drupal\advagg_mod\Asset

Code

public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ExtensionList $module_extension_list) {
    $this->deferType = $config_factory->get('advagg_mod.settings')
        ->get('css_defer_js_code');
    $this->counter = $config_factory->get('advagg.settings')
        ->get('global_counter');
    $this->moduleHandler = $module_handler;
    $this->skipList = [];
    $this->moduleExtensionList = $module_extension_list;
    // Admin Toolbar 8x fails when deferred.
    if ($this->moduleHandler
        ->moduleExists('admin_toolbar')) {
        $this->skipList[] = Crypt::hashBase64($this->moduleExtensionList
            ->getPath('admin_toolbar') . '/js/admin_toolbar.js' . $this->counter);
    }
}