public function SchemataServiceProvider::alter in Schemata 8
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- src/
SchemataServiceProvider.php, line 17
Class
- SchemataServiceProvider
- Adds schema_json as known format.
Namespace
Drupal\schemataCode
public function alter(ContainerBuilder $container) {
if ($container
->has('http_middleware.negotiation') && is_a($container
->getDefinition('http_middleware.negotiation')
->getClass(), NegotiationMiddleware::class, TRUE)) {
// @see https://www.ietf.org/id/draft-wright-json-schema-00.txt
$container
->getDefinition('http_middleware.negotiation')
->addMethodCall('registerFormat', [
'schema_json',
[
'application/schema+json',
],
]);
}
}