public function AcceptHeaderRoutingTestServiceProvider::alter in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php \Drupal\accept_header_routing_test\AcceptHeaderRoutingTestServiceProvider::alter()
- 10 core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php \Drupal\accept_header_routing_test\AcceptHeaderRoutingTestServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- core/modules/ system/ tests/ modules/ accept_header_routing_test/ src/ AcceptHeaderRoutingTestServiceProvider.php, line 16 
Class
- AcceptHeaderRoutingTestServiceProvider
- Service provider for the accept_header_routing_test module.
Namespace
Drupal\accept_header_routing_testCode
public function alter(ContainerBuilder $container) {
  // Remove the basic content negotiation middleware and replace it with a
  // basic header based one.
  $container
    ->register('http_middleware.negotiation', 'Drupal\\accept_header_routing_test\\AcceptHeaderMiddleware')
    ->addTag('http_middleware', [
    'priority' => 400,
  ]);
}