protected function BackgroundImageCssController::dump in Background Image 8
Same name and namespace in other branches
- 2.x src/Controller/BackgroundImageCssController.php \Drupal\background_image\Controller\BackgroundImageCssController::dump()
- 2.0.x src/Controller/BackgroundImageCssController.php \Drupal\background_image\Controller\BackgroundImageCssController::dump()
1 call to BackgroundImageCssController::dump()
- BackgroundImageCssController::buildCss in src/
Controller/ BackgroundImageCssController.php - Generates the necessary CSS for a background image.
File
- src/
Controller/ BackgroundImageCssController.php, line 239
Class
- BackgroundImageCssController
- Defines a controller to serve image styles.
Namespace
Drupal\background_image\ControllerCode
protected function dump($data, $uri) {
// Save the file.
file_prepare_directory($path, FILE_CREATE_DIRECTORY);
if (!file_exists($uri) && !file_unmanaged_save_data($data, $uri, FILE_EXISTS_REPLACE)) {
return FALSE;
}
// Create gzipped file.
if (extension_loaded('zlib') && \Drupal::config('system.performance')
->get('css.gzip')) {
if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
return FALSE;
}
}
return $uri;
}