You are here

class SchemataServiceProvider in Schemata 8

Adds schema_json as known format.

Hierarchy

Expanded class hierarchy of SchemataServiceProvider

File

src/SchemataServiceProvider.php, line 12

Namespace

Drupal\schemata
View source
class SchemataServiceProvider implements ServiceModifierInterface {

  /**
   * {@inheritdoc}
   */
  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',
        ],
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchemataServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceModifierInterface::alter