You are here

BibciteMarcServiceProvider.php in Bibliography & Citation 8

Same filename and directory in other branches
  1. 2.0.x modules/bibcite_marc/src/BibciteMarcServiceProvider.php

File

modules/bibcite_marc/src/BibciteMarcServiceProvider.php
View source
<?php

namespace Drupal\bibcite_marc;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceModifierInterface;

/**
 * Adds MARC as known format.
 */
class BibciteMarcServiceProvider implements ServiceModifierInterface {

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

}

Classes

Namesort descending Description
BibciteMarcServiceProvider Adds MARC as known format.