core-bundle/src/DependencyInjection/Compiler/MapFragmentsToGlobalsPass.php
public function process(ContainerBuilder $container): void
    {
        $tags = $this->getFragmentTags($container, ContentElementReference::TAG_NAME);
        $elements = $this->getGlobalsMap($tags, 'TL_CTE', ContentProxy::class);

        $tags = $this->getFragmentTags($container, FrontendModuleReference::TAG_NAME);
        $modules = $this->getGlobalsMap($tags, 'FE_MOD', ModuleProxy::class);

        $listener = new Definition(GlobalsMapListener::class, [array_merge($elements, $modules)]);
        $listener->setPublic(true);
        $listener->addTag('contao.hook', ['hook' => 'initializeSystem', 'priority' => 255]);

        $container->setDefinition('contao.listener.'.ContainerBuilder::hash($listener), $listener);
    }
public function process(ContainerBuilder $container): void
    {
        $tags = $this->getFragmentTags($container, ContentElementReference::TAG_NAME);
        $elements = $this->getGlobalsMap($tags, 'TL_CTE', ContentProxy::class);

        $tags = $this->getFragmentTags($container, FrontendModuleReference::TAG_NAME);
        $modules = $this->getGlobalsMap($tags, 'FE_MOD', ModuleProxy::class);

        $listener = new Definition(GlobalsMapListener::class, [array_merge($elements, $modules)]);
        $listener->setPublic(true);
        $listener->addTag('contao.hook', ['hook' => 'initializeSystem', 'priority' => 255]);

        $container->setDefinition('contao.listener.'.ContainerBuilder::hash($listener), $listener);
    }
{@inheritdoc}