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

heimrichhannot / contao-encore-bundle / 24667931129

20 Apr 2026 01:00PM UTC coverage: 73.04% (-0.8%) from 73.813%
24667931129

push

github

web-flow
Support contao twig slot layouts (#34)

112 of 150 new or added lines in 11 files covered. (74.67%)

7 existing lines in 2 files now uncovered.

531 of 727 relevant lines covered (73.04%)

2.03 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\WebpackEncoreBundle\Asset\TagRenderer;
12

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

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

NEW
31
        $this->globalContaoAsset->cleanGlobalArrayFromConfiguration();
×
32

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

NEW
39
        $this->tagRenderer->reset();
×
40

NEW
41
        foreach ($entryPoints->allActive() as $entrypoint) {
×
NEW
42
            if ($entrypoint->requiresCss) {
×
NEW
43
                $GLOBALS['TL_HEAD'][] = $this->tagRenderer->renderWebpackLinkTags($entrypoint->name);
×
44
            }
NEW
45
            if ($entrypoint->head) {
×
NEW
46
                $GLOBALS['TL_HEAD'][] = $this->tagRenderer->renderWebpackScriptTags($entrypoint->name);
×
47
            } else {
NEW
48
                $GLOBALS['TL_BODY'][] = $this->tagRenderer->renderWebpackScriptTags($entrypoint->name);
×
49
            }
50
        }
51
    }
52
}
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