class MetatagServiceProvider in Metatag 8
Service Provider for Metatag.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\metatag\MetatagServiceProvider
Expanded class hierarchy of MetatagServiceProvider
File
- src/
MetatagServiceProvider.php, line 14
Namespace
Drupal\metatagView source
class MetatagServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
$modules = $container
->getParameter('container.modules');
if (isset($modules['serialization'])) {
// Serialization module is enabled, add our metatag normalizers.
// Priority of the metatag normalizer must be higher than other
// general-purpose typed data and field item normalizers.
$metatag = new Definition(MetatagNormalizer::class);
$metatag
->addTag('normalizer', [
'priority' => 30,
]);
$container
->setDefinition('metatag.normalizer.metatag', $metatag);
$metatag_hal = new Definition(MetatagHalNormalizer::class);
$metatag_hal
->addTag('normalizer', [
'priority' => 31,
]);
$container
->setDefinition('metatag.normalizer.metatag.hal', $metatag_hal);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MetatagServiceProvider:: |
public | function |
Modifies existing service definitions. Overrides ServiceProviderBase:: |
|
ServiceProviderBase:: |
public | function |
Registers services to the container. Overrides ServiceProviderInterface:: |
1 |