You are here

function advagg_mod_css_defer_active in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 8.4 advagg_mod/advagg_mod.module \advagg_mod_css_defer_active()
  2. 8.3 advagg_mod/advagg_mod.module \advagg_mod_css_defer_active()

Determines whether css defering should be active for the current request.

3 calls to advagg_mod_css_defer_active()
advagg_mod_advagg_asset_render_alter in advagg_mod/advagg_mod.module
Implements hook_advagg_asset_render_alter().
advagg_mod_js_alter in advagg_mod/advagg_mod.module
Implements hook_js_alter().
advagg_mod_page_attachments_alter in advagg_mod/advagg_mod.module
Implements hook_page_attachments_alter().

File

advagg_mod/advagg_mod.module, line 438
Advanced aggregation modifier module.

Code

function advagg_mod_css_defer_active() {
  $config = \Drupal::config('advagg_mod.settings');
  if (!$config
    ->get('css_defer')) {
    return FALSE;
  }
  $admin_route = \Drupal::service('router.admin_context')
    ->isAdminRoute();
  if ($admin_route && !$config
    ->get('css_defer_admin')) {
    return FALSE;
  }
  return TRUE;
}