function FileServiceProvider::alter

Same name in other branches
  1. 8.9.x core/modules/file/src/FileServiceProvider.php \Drupal\file\FileServiceProvider::alter()
  2. 10 core/modules/file/src/FileServiceProvider.php \Drupal\file\FileServiceProvider::alter()
  3. 11.x core/modules/file/src/FileServiceProvider.php \Drupal\file\FileServiceProvider::alter()

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\file

Code

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',
            ],
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.