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

Yoast / Yoast-SEO-for-TYPO3 / 24723291290

21 Apr 2026 12:50PM UTC coverage: 10.457% (+9.2%) from 1.275%
24723291290

push

github

web-flow
Merge pull request #632 from Yoast/feature/yoast-v12

[FEATURE] Version 12.0.0, added v14 support, removed v11 support including php8.0 and php8.1, rewrote backend javascript functionality to typescript and webcomponents

40 of 806 new or added lines in 69 files covered. (4.96%)

40 existing lines in 23 files now uncovered.

284 of 2716 relevant lines covered (10.46%)

0.29 hits per line

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

0.0
/Classes/EventListener/ModifyPageLayoutContentListener.php
1
<?php
2

3
/**
4
 * This file is part of the "yoast_seo" extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.txt file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
namespace YoastSeoForTypo3\YoastSeo\EventListener;
13

14
use TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent;
15
use YoastSeoForTypo3\YoastSeo\Dto\RequestData;
16
use YoastSeoForTypo3\YoastSeo\Service\PageLayoutHeader\PageDataService;
17
use YoastSeoForTypo3\YoastSeo\Service\PageLayoutHeader\PageLayoutHeaderRenderer;
18
use YoastSeoForTypo3\YoastSeo\Service\PageLayoutHeader\VisibilityChecker;
19
use YoastSeoForTypo3\YoastSeo\Service\SnippetPreview\SnippetPreviewConfigurationBuilder;
20
use YoastSeoForTypo3\YoastSeo\Service\SnippetPreviewService;
21

22
class ModifyPageLayoutContentListener
23
{
24
    public function __construct(
25
        protected SnippetPreviewService $snippetPreviewService,
26
        protected SnippetPreviewConfigurationBuilder $snippetPreviewConfigurationBuilder,
27
        protected PageLayoutHeaderRenderer $pageLayoutHeaderRenderer,
28
        protected VisibilityChecker $visibilityChecker,
29
        protected PageDataService $pageDataService
30
    ) {}
×
31

32
    public function __invoke(ModifyPageLayoutContentEvent $event): void
33
    {
34
        $languageId = $this->getLanguageId();
×
NEW
35
        $pageId = (int)($event->getRequest()->getQueryParams()['id'] ?? 0);
×
NEW
36
        $currentPage = $this->pageDataService->getCurrentPage($pageId, $languageId, $event->getModuleTemplate());
×
37

NEW
38
        if (!is_array($currentPage) || !$this->visibilityChecker->shouldShowHeader($pageId, $currentPage)) {
×
NEW
39
            return;
×
40
        }
41

NEW
42
        $snippetPreviewEnabled = $this->visibilityChecker->isSnippetPreviewEnabled($pageId, $currentPage);
×
NEW
43
        $analysisEnabled = $this->visibilityChecker->isAnalysisEnabled($currentPage);
×
44

45
        $this->snippetPreviewService->buildSnippetPreview(
×
NEW
46
            new RequestData($pageId, $languageId),
×
47
            $currentPage,
×
48
            $this->snippetPreviewConfigurationBuilder->buildConfigurationForPage($pageId, $currentPage, $languageId)
×
49
        );
×
50

NEW
51
        $event->addHeaderContent($this->pageLayoutHeaderRenderer->render($snippetPreviewEnabled, $analysisEnabled));
×
52
    }
53

54
    protected function getLanguageId(): int
55
    {
56
        $request = $GLOBALS['TYPO3_REQUEST'] ?? null;
×
57
        if ($request === null) {
×
58
            return 0;
×
59
        }
60

61
        $moduleData = $request->getAttribute('moduleData');
×
62
        if ($moduleData === null) {
×
63
            return 0;
×
64
        }
65

NEW
66
        $language = $moduleData->get('language');
×
NEW
67
        if ($language === null) {
×
NEW
68
            $languages = $moduleData->get('languages');
×
NEW
69
            if (is_array($languages) && count($languages) > 0) {
×
NEW
70
                $language = (int)$languages[0];
×
71
            } else {
NEW
72
                $language = 0;
×
73
            }
74
        }
75

76
        if ($language === -1) {
×
77
            return 0;
×
78
        }
79

NEW
80
        return (int)$language;
×
81
    }
82
}
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