You are here

class BibciteBibtexServiceProvider in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_bibtex/src/BibciteBibtexServiceProvider.php \Drupal\bibcite_bibtex\BibciteBibtexServiceProvider

Adds BibTeX as known format.

Hierarchy

Expanded class hierarchy of BibciteBibtexServiceProvider

File

modules/bibcite_bibtex/src/BibciteBibtexServiceProvider.php, line 11

Namespace

Drupal\bibcite_bibtex
View source
class BibciteBibtexServiceProvider 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', [
          'bibtex',
          [
            'text/plain',
            'application/x-bibtex',
          ],
        ]);
      }
    }
  }

}

Members

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