class LayoutBuilderServiceProvider in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider
Sets the layout_builder.get_block_dependency_subscriber service definition.
This service is dependent on the block_content module so it must be provided dynamically.
@internal Service providers are internal.
Hierarchy
- class \Drupal\layout_builder\LayoutBuilderServiceProvider implements ServiceProviderInterface
Expanded class hierarchy of LayoutBuilderServiceProvider
See also
\Drupal\layout_builder\EventSubscriber\SetInlineBlockDependency
File
- core/
modules/ layout_builder/ src/ LayoutBuilderServiceProvider.php, line 24
Namespace
Drupal\layout_builderView source
class LayoutBuilderServiceProvider implements ServiceProviderInterface {
/**
* {@inheritdoc}
*/
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);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LayoutBuilderServiceProvider:: |
public | function |
Registers services to the container. Overrides ServiceProviderInterface:: |