You are here

protected function JsOptimizer::addDnsPrefetch in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 src/Asset/JsOptimizer.php \Drupal\advagg\Asset\JsOptimizer::addDnsPrefetch()

Extract any domains to prefetch DNS.

Parameters

array $asset: A core asset definition array.

Return value

array An array of domains to prefetch.

Overrides AssetOptimizer::addDnsPrefetch

File

src/Asset/JsOptimizer.php, line 25

Class

JsOptimizer
The JavaScript Optimizer.

Namespace

Drupal\advagg\Asset

Code

protected function addDnsPrefetch(array $asset) {

  // Check if Google Ad Manager and add DNS prefetch.
  $prefetch = $this
    ->testForGoogleAdManager($asset['data']);

  // Check if Google Analytics and add DNS prefetch.
  $prefetch += $this
    ->testForGoogleAnalytics($asset['data']);
  return $prefetch;
}