function AssetDumper::dump
Same name in other branches
- 9 core/lib/Drupal/Core/Asset/AssetDumper.php \Drupal\Core\Asset\AssetDumper::dump()
- 8.9.x core/lib/Drupal/Core/Asset/AssetDumper.php \Drupal\Core\Asset\AssetDumper::dump()
- 10 core/lib/Drupal/Core/Asset/AssetDumper.php \Drupal\Core\Asset\AssetDumper::dump()
The file name for the CSS or JS cache file is generated from the hash of the aggregated contents of the files in $data. This forces proxies and browsers to download new CSS when the CSS changes.
Overrides AssetDumperInterface::dump
File
-
core/
lib/ Drupal/ Core/ Asset/ AssetDumper.php, line 39
Class
- AssetDumper
- Dumps a CSS or JavaScript asset.
Namespace
Drupal\Core\AssetCode
public function dump($data, $file_extension) {
$path = 'assets://' . $file_extension;
// Prefix filename to prevent blocking by firewalls which reject files
// starting with "ad*".
$filename = $file_extension . '_' . Crypt::hashBase64($data) . '.' . $file_extension;
$uri = $path . '/' . $filename;
return $this->dumpToUri($data, $file_extension, $uri);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.