You are here

function hook_advagg_js_contents_alter in Advanced CSS/JS Aggregation 8.2

Allow other modules to modify the contents of individual JavaScript files.

Called once per file at aggregation time.

Parameters

string $contents: Raw file data.

array $js_asset: Asset array.

See also

\Drupal\advagg\Asset\JsCollectionOptimizer::optimize()

Related topics

1 invocation of hook_advagg_js_contents_alter()
JsCollectionOptimizer::optimize in src/Asset/JsCollectionOptimizer.php
The cache file name is retrieved on a page load via a lookup variable that contains an associative array. The array key is the hash of the names in $files while the value is the cache file name. The cache file is generated in two cases. First, if…

File

./advagg.api.php, line 119
Hooks provided by the AdvAgg module.

Code

function hook_advagg_js_contents_alter(&$contents, array $js_asset) {
  if ($js_asset['data'] == 'modules/advagg/advagg.admin.js') {
    $contents = str_replace('AdvAgg Bypass Cookie Removed', 'Advanced Aggregates Cookie Removed', $contents);
  }
}