class LayoutBuilderServiceProvider

Same name in other branches
  1. 9 core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider
  2. 8.9.x core/modules/layout_builder/src/LayoutBuilderServiceProvider.php \Drupal\layout_builder\LayoutBuilderServiceProvider
  3. 10 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

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_builder
View 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

Title Sort descending Modifiers Object type Summary Overriden Title
LayoutBuilderServiceProvider::register public function Registers services to the container. Overrides ServiceProviderInterface::register

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