public function BibciteBibtexServiceProvider::alter in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_bibtex/src/BibciteBibtexServiceProvider.php \Drupal\bibcite_bibtex\BibciteBibtexServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- modules/
bibcite_bibtex/ src/ BibciteBibtexServiceProvider.php, line 16
Class
- BibciteBibtexServiceProvider
- Adds BibTeX as known format.
Namespace
Drupal\bibcite_bibtexCode
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',
],
]);
}
}
}