public function SmartDateServiceProvider::alter in Smart Date 3.3.x
Same name and namespace in other branches
- 3.0.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider::alter()
- 3.1.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider::alter()
- 3.2.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider::alter()
- 3.4.x src/SmartDateServiceProvider.php \Drupal\smart_date\SmartDateServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceProviderBase::alter
File
- src/
SmartDateServiceProvider.php, line 18
Class
- SmartDateServiceProvider
- Service Provider for Smart Date.
Namespace
Drupal\smart_dateCode
public function alter(ContainerBuilder $container) {
$modules = $container
->getParameter('container.modules');
if (isset($modules['hal'])) {
// HAL module is enabled, add our Smart Date normalizer.
// Priority of the normalizer must be higher than other
// general-purpose typed data and field item normalizers.
$smart_date = new Definition(SmartDateNormalizer::class);
$smart_date
->addTag('normalizer', [
'priority' => 30,
]);
$container
->setDefinition('smart_date.normalizer.smartdate.hal', $smart_date);
}
}