function LayoutBuilderServiceProvider::register

Same name in other branches
  1. 9 core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider::register()
  2. 8.9.x core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider::register()
  3. 11.x core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider::register()

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_builder

Code

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.