public function S3fsServiceProvider::alter in S3 File System 8.2
Same name and namespace in other branches
- 8.3 src/S3fsServiceProvider.php \Drupal\s3fs\S3fsServiceProvider::alter()
- 4.0.x src/S3fsServiceProvider.php \Drupal\s3fs\S3fsServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- src/
S3fsServiceProvider.php, line 23
Class
- S3fsServiceProvider
- The stream wrapper class.
Namespace
Drupal\s3fsCode
public function alter(ContainerBuilder $container) {
if (Settings::get('s3fs.use_s3_for_public')) {
// Replace the public stream wrapper with S3fsStream.
$container
->getDefinition('stream_wrapper.public')
->setClass('Drupal\\s3fs\\StreamWrapper\\PublicS3fsStream');
}
if (Settings::get('s3fs.use_s3_for_private')) {
// Replace the private stream wrapper with S3fsStream.
$container
->getDefinition('stream_wrapper.private')
->setClass('Drupal\\s3fs\\StreamWrapper\\PrivateS3fsStream');
}
// Fix CSS static urls
$container
->getDefinition('asset.css.optimizer')
->setClass('Drupal\\s3fs\\S3fsCssOptimizer');
}