• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

heimrichhannot / contao-encore-bundle / 24708476128

21 Apr 2026 06:53AM UTC coverage: 73.58% (+0.5%) from 73.04%
24708476128

push

github

web-flow
Add symfony debug bar support (#35)

26 of 30 new or added lines in 3 files covered. (86.67%)

1 existing line in 1 file now uncovered.

557 of 757 relevant lines covered (73.58%)

2.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/EventListener/InjectPageEntriesListener.php
1
<?php
2

3
namespace HeimrichHannot\EncoreBundle\EventListener;
4

5
use Contao\CoreBundle\Event\LayoutEvent;
6
use HeimrichHannot\EncoreBundle\Asset\FrontendAsset;
7
use HeimrichHannot\EncoreBundle\Asset\GlobalContaoAsset;
8
use HeimrichHannot\EncoreBundle\EntryPoint\EntryPointBuilderFactory;
9
use HeimrichHannot\EncoreBundle\Helper\ConfigurationHelper;
10
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
11
use Symfony\Component\HttpFoundation\RequestStack;
12
use Symfony\WebpackEncoreBundle\Asset\TagRenderer;
13

14
class InjectPageEntriesListener
15
{
16
    public function __construct(
17
        private readonly TagRenderer $tagRenderer,
18
        private readonly EntryPointBuilderFactory $entrypointBuilderFactory,
19
        private readonly FrontendAsset $frontendAsset,
20
        private readonly GlobalContaoAsset $globalContaoAsset,
21
        private readonly ConfigurationHelper $configurationHelper,
22
        private readonly RequestStack $requestStack,
23
    ) {
24
    }
×
25

26
    #[AsEventListener]
27
    public function onLayoutEvent(LayoutEvent $event): void
28
    {
29
        if (!$this->configurationHelper->isEnabledOnPage($event->getPage(), $event->getLayout())) {
×
30
            return;
×
31
        }
32

33
        $this->globalContaoAsset->cleanGlobalArrayFromConfiguration();
×
34

35
        $entryPoints = $this->entrypointBuilderFactory->create()
×
36
            ->setPage($event->getPage())
×
37
            ->setLayout($event->getLayout())
×
38
            ->setFrontendAsset($this->frontendAsset)
×
39
            ->build();
×
40

NEW
41
        if ($request = $this->requestStack->getCurrentRequest()) {
×
NEW
42
            $request->attributes->add([
×
NEW
43
                'encore_entries' => $entryPoints,
×
NEW
44
            ]);
×
45
        }
46

UNCOV
47
        $this->tagRenderer->reset();
×
48

49
        foreach ($entryPoints->allActive() as $entrypoint) {
×
50
            if ($entrypoint->requiresCss) {
×
51
                $GLOBALS['TL_HEAD'][] = $this->tagRenderer->renderWebpackLinkTags($entrypoint->name);
×
52
            }
53
            if ($entrypoint->head) {
×
54
                $GLOBALS['TL_HEAD'][] = $this->tagRenderer->renderWebpackScriptTags($entrypoint->name);
×
55
            } else {
56
                $GLOBALS['TL_BODY'][] = $this->tagRenderer->renderWebpackScriptTags($entrypoint->name);
×
57
            }
58
        }
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc