public function LayoutBuilderServiceProvider::register in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider::register()
Registers services to the container.
Parameters
ContainerBuilder $container: The ContainerBuilder to register services to.
Overrides ServiceProviderInterface::register
File
- core/
modules/ layout_builder/ src/ LayoutBuilderServiceProvider.php, line 29
Class
- LayoutBuilderServiceProvider
- Sets the layout_builder.get_block_dependency_subscriber service definition.
Namespace
Drupal\layout_builderCode
public function register(ContainerBuilder $container) {
$modules = $container
->getParameter('container.modules');
if (isset($modules['block_content'])) {
$definition = new Definition(SetInlineBlockDependency::class);
$definition
->setArguments([
new Reference('entity_type.manager'),
new Reference('database'),
new Reference('inline_block.usage'),
new Reference('plugin.manager.layout_builder.section_storage'),
]);
$definition
->addTag('event_subscriber');
$definition
->setPublic(TRUE);
$container
->setDefinition('layout_builder.get_block_dependency_subscriber', $definition);
}
if (isset($modules['serialization'])) {
$definition = (new ChildDefinition('serializer.normalizer.config_entity'))
->setClass(LayoutEntityDisplayNormalizer::class)
->addTag('normalizer', [
'priority' => 5,
]);
$container
->setDefinition('layout_builder.normalizer.layout_entity_display', $definition);
}
}