class YamlformServiceProvider in YAML Form 8
Service Provider for Yamlform.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\yamlform\YamlformServiceProvider
Expanded class hierarchy of YamlformServiceProvider
File
- src/
YamlformServiceProvider.php, line 13
Namespace
Drupal\yamlformView source
class YamlformServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
$modules = $container
->getParameter('container.modules');
if (isset($modules['hal'])) {
// Hal module is enabled, add our new normalizer for yamlform items.
$service_definition = new Definition('Drupal\\yamlform\\Normalizer\\YamlFormEntityReferenceItemNormalizer', [
new Reference('rest.link_manager'),
new Reference('serializer.entity_resolver'),
]);
// The priority must be higher than that of
// serializer.normalizer.entity_reference_item.hal in
// hal.services.yml.
$service_definition
->addTag('normalizer', [
'priority' => 20,
]);
$container
->setDefinition('serializer.normalizer.yamlform_entity_reference_item', $service_definition);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ServiceProviderBase:: |
public | function |
Registers services to the container. Overrides ServiceProviderInterface:: |
1 |
YamlformServiceProvider:: |
public | function |
Modifies existing service definitions. Overrides ServiceProviderBase:: |