You are here

class BibciteEndnoteServiceProvider in Bibliography & Citation 8

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

Adds EndNote as known format.

Hierarchy

Expanded class hierarchy of BibciteEndnoteServiceProvider

File

modules/bibcite_endnote/src/BibciteEndnoteServiceProvider.php, line 11

Namespace

Drupal\bibcite_endnote
View source
class BibciteEndnoteServiceProvider 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', [
          'endnote7',
          [
            'text/xml',
            'application/x-endnote-refer',
          ],
        ]);
        $definition
          ->addMethodCall('registerFormat', [
          'endnote8',
          [
            'text/xml',
            'application/x-endnote-refer',
          ],
        ]);
        $definition
          ->addMethodCall('registerFormat', [
          'tagged',
          [
            'text/plain',
            'application/x-endnote-refer',
          ],
        ]);
      }
    }
  }

}

Members

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