‪TYPO3CMS  ‪main
Services.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 namespace ‪TYPO3\CMS\Webhooks;
6 
7 use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
8 use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
9 use Symfony\Component\DependencyInjection\ChildDefinition;
10 use Symfony\Component\DependencyInjection\ContainerBuilder;
11 use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
14 use TYPO3\CMS\Webhooks\ConfigurationModuleProvider\WebhookTypesProvider;
15 
16 return static function (ContainerConfigurator $container, ContainerBuilder $containerBuilder) {
17  $containerBuilder->registerAttributeForAutoconfiguration(
18  WebhookMessage::class,
19  static function (ChildDefinition $definition, ‪WebhookMessage $attribute): void {
20  $definition->addTag(‪WebhookMessage::TAG_NAME, ['identifier' => $attribute->identifier, 'description' => $attribute->description, 'method' => $attribute->method]);
21  }
22  );
23  $containerBuilder->addCompilerPass(new DependencyInjection\WebhookCompilerPass(‪WebhookMessage::TAG_NAME));
24 
25  if ($containerBuilder->hasDefinition(ProviderRegistry::class)) {
26  $container->services()->defaults()->autowire()->autoconfigure()->public()
27  ->set('lowlevel.configuration.module.provider.webhooks')
28  ->class(WebhookTypesProvider::class)
29  ->arg('$sendersLocator', new ServiceLocatorArgument(new TaggedIteratorArgument('messenger.sender', 'identifier')))
30  ->tag(
31  'lowlevel.configuration.module.provider',
32  [
33  'identifier' => 'webhooks',
34  'label' => 'LLL:EXT:webhooks/Resources/Private/Language/locallang_db.xlf:webhooks',
35  'after' => 'reactions',
36  ]
37  );
38  }
39 };
‪TYPO3\CMS\Core\Attribute\WebhookMessage
Definition: WebhookMessage.php:25
‪TYPO3\CMS\Core\Attribute\WebhookMessage\TAG_NAME
‪const TAG_NAME
Definition: WebhookMessage.php:26
‪TYPO3\CMS\Webhooks
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\ProviderRegistry
Definition: ProviderRegistry.php:24