You are here

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

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

Modifies existing service definitions.

Parameters

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

Overrides ServiceModifierInterface::alter

File

modules/bibcite_ris/src/BibciteRisServiceProvider.php, line 16

Class

BibciteRisServiceProvider
Adds RIS as known format.

Namespace

Drupal\bibcite_ris

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', [
        'ris',
        [
          'text/plain',
          'application/x-research-info-systems',
        ],
      ]);
    }
  }
}