You are here

public function AccessUnpublishedServiceProvider::alter in Access unpublished 8

Modifies existing service definitions.

Parameters

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

Overrides ServiceProviderBase::alter

File

src/AccessUnpublishedServiceProvider.php, line 18

Class

AccessUnpublishedServiceProvider
Decorates the access_check.latest_revision service.

Namespace

Drupal\access_unpublished

Code

public function alter(ContainerBuilder $container) {
  if ($container
    ->hasDefinition('access_check.latest_revision')) {
    $container
      ->register('access_unpublished.access_check.latest_revision', LatestRevisionCheck::class)
      ->setDecoratedService('access_check.latest_revision')
      ->addArgument(new Reference('access_unpublished.access_check.latest_revision.inner'))
      ->addTag('access_check', [
      'applies_to' => '_content_moderation_latest_version',
    ]);
  }
}