JsCollectionOptimizer::generateHash

protected JsCollectionOptimizer::generateHash(array $js_group)

Generate a hash for a given group of JavaScript assets.

Parameters

array $js_group: A group of JavaScript assets.

Return value

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

File

core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php, line 161

Class

JsCollectionOptimizer
Optimizes JavaScript assets.

Namespace

Drupal\Core\Asset

Code

1
2
3
4
5
6
7
protected function generateHash(array $js_group) {
  $js_data = array();
  foreach ($js_group['items'] as $js_file) {
    $js_data[] = $js_file['data'];
  }
  return hash('sha256', serialize($js_data));
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.