You are here

public function DepcalcServiceProvider::alter in Dependency Calculation 8

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceProviderBase::alter

File

src/DepcalcServiceProvider.php, line 17

Class

DepcalcServiceProvider
Optionally adds to the container when content_moderation is enabled.

Namespace

Drupal\depcalc

Code

public function alter(ContainerBuilder $container) {
  parent::alter($container);
  if ($container
    ->hasDefinition('content_moderation.moderation_information')) {
    $container
      ->getDefinition('workflow.dependency_calculator')
      ->addArgument(new Reference('content_moderation.moderation_information'));
  }
  if ($container
    ->hasDefinition('plugin.manager.core.layout')) {
    $container
      ->getDefinition('layout_builder.dependency_calculator')
      ->addArgument(new Reference('plugin.manager.core.layout'));
    $container
      ->getDefinition('layout_builder.entity_view_display.dependency_calculator')
      ->addArgument(new Reference('plugin.manager.core.layout'));
  }
}