You are here

protected function CssCollectionOptimizer::generateHash in Advanced CSS/JS Aggregation 8.2

Generate a hash for a given group of CSS assets.

Parameters

array $css_group: A group of CSS assets.

Return value

string A hash to uniquely identify the given group of CSS assets.

Overrides CssCollectionOptimizer::generateHash

1 call to CssCollectionOptimizer::generateHash()
CssCollectionOptimizer::optimize in src/Asset/CssCollectionOptimizer.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 file names in $css while the value is the cache file name. The cache file is generated in two cases. First, if…

File

src/Asset/CssCollectionOptimizer.php, line 227

Class

CssCollectionOptimizer

Namespace

Drupal\advagg\Asset

Code

protected function generateHash(array $css_group) {
  $css_data = [];
  foreach ($css_group['items'] as $css_file) {
    $css_data[] = $css_file['data'];
    $css_data[] = filemtime($css_file['data']);
  }
  return hash('sha256', serialize($css_data));
}