public function FileServiceProvider::alter in Drupal 9
Same name and namespace in other branches
- 8 core/modules/file/src/FileServiceProvider.php \Drupal\file\FileServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- core/
modules/ file/ src/ FileServiceProvider.php, line 17
Class
- FileServiceProvider
- Adds 'application/octet-stream' as a known (bin) format.
Namespace
Drupal\fileCode
public function alter(ContainerBuilder $container) {
if ($container
->has('http_middleware.negotiation') && is_a($container
->getDefinition('http_middleware.negotiation')
->getClass(), NegotiationMiddleware::class, TRUE)) {
$container
->getDefinition('http_middleware.negotiation')
->addMethodCall('registerFormat', [
'bin',
[
'application/octet-stream',
],
]);
}
}