You are here

public function BibciteMarcServiceProvider::alter in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_marc/src/BibciteMarcServiceProvider.php \Drupal\bibcite_marc\BibciteMarcServiceProvider::alter()

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceModifierInterface::alter

File

modules/bibcite_marc/src/BibciteMarcServiceProvider.php, line 16

Class

BibciteMarcServiceProvider
Adds MARC as known format.

Namespace

Drupal\bibcite_marc

Code

public function alter(ContainerBuilder $container) {
  if ($container
    ->has('http_middleware.negotiation')) {
    $definition = $container
      ->getDefinition('http_middleware.negotiation');
    if (is_a($definition
      ->getClass(), '\\Drupal\\Core\\StackMiddleware\\NegotiationMiddleware', TRUE)) {
      $definition
        ->addMethodCall('registerFormat', [
        'marc',
        [
          'application/marc',
        ],
      ]);
    }
  }
}